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.
This commit is contained in:
Vincent Bernat 2021-07-23 20:27:22 +02:00
parent 45a86fee23
commit d9aafa54a4

View file

@ -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 \