Application specific bindings

asked Jan 25 '15

rds gravatar image

updated Jan 26 '15

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!

Comments

Wouldn't it be easier to just [redefine the key binding in Firefox](http://www.cnet.com/how-to/how-to-customize-firefox-keyboard-shortcuts/)?

Adaephon gravatar imageAdaephon (Jan 26 '15)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 (Jan 26 '15)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 (Jan 27 '15)edit