The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

Using modifer key as a binding

asked 2015-05-04 11:23:04 +0000

teto gravatar image

updated 2015-05-04 13:33:00 +0000

Adaephon gravatar image

Hi,

I've been trying to do a similar setup as in https://faq.i3wm.org/question/5429/st... with my Super_L/Windows/Mod4 key, i.e., I want to enter and stay in a mode as long as my window key is touched.

When doing bindsym Mod4 mode "foo" with i3 (i3 version 4.10.2-145-g37bee99 (2015-04-26, branch "next")), it does not go into mode "foo". If I do bindsym Mod4+f mode "foo" then i3 enters the desired mode but then the bindsym --release Mod4+f within mode "foo" does not work anymore.

Any advice ?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-05-04 13:50:31 +0000

Adaephon gravatar image

updated 2015-05-04 14:02:48 +0000

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)

edit flag offensive delete link more

Comments

Thanks for your help. It makes sense that I would need to set the key rather than the modifier. As you do I notice the Super_L release is not always detected. Your answer helped me do this: https://github.com/i3/i3/issues/1214#issuecomment-97453611

teto gravatar imageteto ( 2015-05-05 12:12:40 +0000 )edit

Question Tools

1 follower

Stats

Asked: 2015-05-04 11:23:04 +0000

Seen: 91 times

Last updated: May 04