On my laptop, I use the Win as a modifier. With the Fn key pressed, the key sends a different keysym and I use that as a Compose key.
keycode 133 = Hyper_L
keycode 134 = Multi_key
add mod4 = Hyper_L
I have some window manager key bindings of the form Hyper+KP_N. On a laptop, this requires pressing and holding Win, then pressing and holding Fn, then pressing KP_N and finally releasing everything. If I press Fn before Hyper, this sends the Multi_key keysym instead of Hyper_L, so I'm pressing Compose. I find the finger coordination required to press Fn before Hyper to be a lot less, so I'd like to be able to do that. If I then press a keypad key (which requires Fn), I want the key press to be interpreted as the mod4 modifier instead of Multi_key.
I can add the mod4 modifier to the Multi_key keysym, and this makes my window manager bindings work when I press Fn and Hyper in either order. However, if I press Fn first (which is how it happens naturally), this records a Multi_key keysym, so a key sequence like Fn+Hyper+KP_1, a, ' ends up switching to workspace 1 and inserting á instead of 'a, because the application that is focused after the keyboard shortcut activates receives a key release event for Multi_key.
How can I have my cake and eat it?
- If I press Hyper and Fn in either order, then press a keypad key, this should only trigger my window manager binding and not leave a pending
Compose. Either the application should not receive a key release event forMulti_key, or it should receive another event (injected by the window manager) that will effectively cancel the first one. - If I press and hold Fn and press Hyper, then release them both, this should send a press and release event for
Multi_key.
I don't mind whether this is done through a change of my keyboard configuration, or of my window manager bindings, or both. The window manager is sawfish, so it's pretty flexible.
If the solution involves XKB, I don't want to define my whole keyboard configuration through XKB. The XKB part should focus on defining a group for the affected keys (or whatever it takes).