From 8113508e6d5878295a05d139a96c76d59086954e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 14 Dec 2021 14:28:08 +0100 Subject: [PATCH] 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. --- bootstrap/packages.txt | 2 +- pass/.local/bin/pass-pick | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bootstrap/packages.txt b/bootstrap/packages.txt index a0f0eb5..674b898 100644 --- a/bootstrap/packages.txt +++ b/bootstrap/packages.txt @@ -256,7 +256,7 @@ waylock wl-clipboard clipman libqalculate -ydotool brightnessctl grim slurp +wtype diff --git a/pass/.local/bin/pass-pick b/pass/.local/bin/pass-pick index 02ccfe2..d494fdf 100755 --- a/pass/.local/bin/pass-pick +++ b/pass/.local/bin/pass-pick @@ -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"