Space as modifier key XKB
Solution 1:
I found that Space2Ctrl is a best tool to do this remapping. Very easy, do not require any configuration and works as intended without excess delays. I tried keydouble but it introduced noticeable delay before space was shown on screen
Solution 2:
I think you're going to have immense difficulty getting the 'tap to space; hold to shift' behavior.
That said, you can use xkbcomp :0.0
to dump the current keymap from the server to a file server-0_0.xkb
, and I think I see an easy way to get the space bar to function as as modifier:
key <LALT> { [ Alt_L, Meta_L ] };
key <SPCE> { [ space ] };
....
modifier_map Mod1 { <LALT> };
modifier_map Lock { <CAPS> };
Try replacing space
with Mod5
(or whichever modifier key makes most sense), and then add a new modifier_map
line:
key <LALT> { [ Alt_L, Meta_L ] };
key <SPCE> { [ Meta5 ] };
....
modifier_map Mod1 { <LALT> };
modifier_map Lock { <CAPS> };
modifier_map Meta5 { <SPCE> };
This is untested, but it feels right.
I don't know how you'll get a plain old space though. I'd suggest mapping it to another key entirely.
Solution 3:
Consider using keydouble. It's a user-space utility that attaches itself to X and continues to grab and processes keyboard events. The default configuration provided in examples/keydoublerc
does exactly what you want - space becomes ctrl. If it is not used with another key then space is inserted upon key release.