From 651fd95fb6e4632ff3eb5587eb70256a92625183 Mon Sep 17 00:00:00 2001 From: Wayne Walker Date: Fri, 17 Sep 2021 19:47:36 -0500 Subject: [PATCH] Fix issue #62 - race condition for modifiers --- bwmenu | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bwmenu b/bwmenu index a9c342d..7f0d5d3 100755 --- a/bwmenu +++ b/bwmenu @@ -15,6 +15,8 @@ ITEMS= # Stores which command will be used to emulate keyboard type AUTOTYPE_MODE= +# Stores the argument need by xdotool to clear the modifiers (shift, control, alt, ...) first +CLEAR_MODIFIERS= # Stores which command will be used to deal with clipboards CLIPBOARD_MODE= @@ -244,16 +246,17 @@ select_autotype_command() { AUTOTYPE_MODE=(sudo ydotool) elif [ "$XDG_SESSION_TYPE" != "wayland" ] && hash xdotool 2>/dev/null; then AUTOTYPE_MODE=xdotool + CLEAR_MODIFIERS="--clearmodifiers" fi fi } type_word() { - "${AUTOTYPE_MODE[@]}" type "$1" + "${AUTOTYPE_MODE[@]}" type $CLEAR_MODIFIERS "$1" } type_tab() { - "${AUTOTYPE_MODE[@]}" key Tab + "${AUTOTYPE_MODE[@]}" key $CLEAR_MODIFIERS Tab }