Application specific bindings

asked 2015-01-25 21:02:51 +0000

rds gravatar image

updated 2015-01-26 17:23:38 +0000

Is there a way to have custom bindings specific to some application. E.g.:

# bindsym --release F4 [class="Anki"] exec --no-startup-id xdotool key --clearmodifiers Ctrl+z

To bind F4 to Ctrl+z in Anki, but nowhere else (this is just an example). This is meant for the applications that themselves do not offer a way to change bindings.

Thank you very much!

edit retag flag offensive close merge delete


Wouldn't it be easier to just [redefine the key binding in Firefox](

Adaephon gravatar imageAdaephon ( 2015-01-26 12:13:08 +0000 )edit

Right... Firefox wasn't the best example, sorry. I'm asking because many appllications do not have a direct way to change their bindings.

rds gravatar imagerds ( 2015-01-26 17:22:27 +0000 )edit

*i3* criteria do not work for `exec`, so this does not work here. You could write a script that does things depending on the current window (`xprop -id $(xdotool getwindowfocus)`). But if you send a key to which it is bound, you will probably run into a recursion.

Adaephon gravatar imageAdaephon ( 2015-01-27 06:50:42 +0000 )edit