It does not work, because Mod4
is the name of the modifier but not the name of the key (keysym). The correct name would probably be either Super_L
or Super_R
, for the left and right Windows key respectively.
So this should work in your case:
bindsym Super_L mode "foo"
bindsym Super_R mode "foo"
mode "foo" {
# ...
bindsym --release Super_L mode "default"
bindsym --release Super_R mode "default"
}
Of course, you can drop the lines with either Super_L
or Super_R
in them, if you want to use only respective other key.
To find out, what the keysym (or keycode for that matter) of a key is, you can use xev
.
The modifier names Mod1
, Mod4
, Shift
, etc. can only be used in conjunction with a keysym or keycode (e.g. bindsym Mod4+f ...
or bindcode Mod4+41 ...
)
It is even possible to combine modifier keys that way. bindsym Mod4+Super_L ...
will bind to the left Window key being pressed, while the right one is held down (but not the other way around).
Note: I would suggest using bindcode
instead of bindsym
when working with modifier-only keybindings. It seems that in some cases it does not work when using keysyms, at least for me. (e.g. Shift+Shift_L
)