pass: Add wtype typer tool to pass-pick

Added wtype as the preferred alternative to ydotool for wayland setups
to the pass picking sript.
Still supports xdotool and ydotool.
This commit is contained in:
Marty Oehme 2021-12-14 14:28:08 +01:00
parent 60ae405790
commit 8113508e6d
Signed by: Marty
GPG key ID: B7538B8F50A1C800
2 changed files with 9 additions and 3 deletions

View file

@ -256,7 +256,7 @@ waylock
wl-clipboard
clipman
libqalculate
ydotool
brightnessctl
grim
slurp
wtype

View file

@ -105,7 +105,7 @@ set_defaults() {
KEY_ENTRYMENU_SHOWFIELD="${KEY_ENTRYMENU_SHOWFIELD:-$(get_config KEY_ENTRYMENU_SHOWFIELD Alt+s)}"
KEY_ENTRYMENU_QUIT="${PP_KEY_ENTRYMENU_QUIT:-$(get_config KEY_ENTRYMENU_QUIT Alt+BackSpace)}"
AUTOFILL_BACKEND="${PP_AUTOFILL_BACKEND:-$(get_config AUTOFILL_BACKEND ydotool)}"
AUTOFILL_BACKEND="${PP_AUTOFILL_BACKEND:-$(get_config AUTOFILL_BACKEND wtype)}"
AUTOFILL_CHAIN="${PP_AUTOENTRY_CHAIN:-$(get_config AUTOFILL_CHAIN 'username :tab password')}"
AUTOFILL_DELAY="${PP_AUTOENTRY_DELAY:-$(get_config AUTOFILL_DELAY 30)}"
PASS_USERNAME_FIELD="${PP_PASS_USERNAME_FIELD:-$(get_config PASS_USERNAME_FIELD 'username user login')}"
@ -213,7 +213,13 @@ _type() {
local toolmode="$1"
local key="$2"
if [ "$tool" = "xdotool" ]; then
if [ "$tool" = "wtype" ]; then
if [ "$toolmode" = "type" ]; then
"$tool" -s "${AUTOFILL_DELAY}" -- "$key"
elif [ "$toolmode" = "key" ]; then
"$tool" -s "${AUTOFILL_DELAY}" -k "$key"
fi
elif [ "$tool" = "xdotool" ]; then
"$tool" "$toolmode" --delay "${AUTOFILL_DELAY}" "$key"
elif [ "$tool" = "ydotool" ]; then
"$tool" "$toolmode" --key-delay "${AUTOFILL_DELAY}" "$key"