From d9aafa54a42d21a695be470f895ece2f9270ee1a Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Fri, 23 Jul 2021 20:27:22 +0200 Subject: [PATCH] rofi-mediaplayer: grab keyboard as soon as possible Otherwise, we may miss the shortcut input. With -no-lazy-grab, rofi grabs the keyboard early and wait for half a second before giving up. Without, it will try for 0 second. So, if i3 still has the grab, it will try again every millisecond for 5 seconds. However, this needs to get scheduled after everything else, so in practice, this can take some time. I get better results with -no-lazy-grab. Also, we could use --release from i3. In this case, we are guaranteed that rofi can grab the keyboard during the first try. But, after trying a bit, I think this is still better with -no-lazy-grab: the shell script needs to be executed, rofi needs to be executed. It's better to do that while the user did not depress the key yet. --- bin/rofi-mediaplayer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/rofi-mediaplayer b/bin/rofi-mediaplayer index 1a36bfc..ac63777 100755 --- a/bin/rofi-mediaplayer +++ b/bin/rofi-mediaplayer @@ -5,7 +5,7 @@ if [ -z "${ROFI_OUTSIDE}" ]; then export mediaplayer=$1 export Mediaplayer=$(echo $1 | sed -E 's/(.)/\U\1/') - exec rofi -show-icons -no-custom -modi m:$0 -show m \ + exec rofi -no-lazy-grab -show-icons -no-custom -modi m:$0 -show m \ -kb-select-1 Super+z \ -kb-select-2 Super+x \ -kb-select-3 Super+c \