💾 Archived View for heavysquare.com › notes › FFF7-xdotool-key-to-wm-trigger.txt captured on 2022-04-29 at 11:17:34.

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-


~~ 2020-12-27T14:54:43+01:00

I wrote myself a launcher system that helps me launching applications
big time. Recently I extended this system with it sending keys to my
window manager, dwm, via `xdotool key`. Nice and easy.

The launcher works in a way so that it reacts to keys directly, so you
don't have to press the Enter key at the end. Tech details are

stty -icanon -echo && c=$(dd bs=1 count=1 2>/dev/null) && stty icanon echo


I had an action which worked fine, it opened or made an already opened
instance visible of an application. I changed the application name and
it's not working. It was really weird. Even, it was the same application,
but different arguments. I spent like 15 minutes to study how that
different argument could interfere with the system. It seemed that the
last `xdotool key` call was not going through for some reason. Hmm.

Trigger key for the first/old action was o, so the last step of interacting
with the launcher was pressing the o key. And then the magic happened.

For the second/newer action, which was not working, the last step was
pressing S. Capital s.

The wm line in these launch scripts were: `xdotool key alt+u`

It turns out that when you trigger the second launcher with S, you press
shift, hold it down, press s,

1. then the launcher starts it's action immediately
2. does everything, even running `xdotool key alt+u`
3. but by that time, you're likely to still hold shift,
   so the wm gets an alt+shift+u instead of the intended
   alt+u
4. that combination, alt+shift+u was not mapped to anything, so
   it looked like nothing had happened

QED