I use a tiling window manager (xMonad at the moment), and due to this I need a key that acts as the ‘control key’ for window management. Whenever I use a keyboard with Windows/Super/Mod4 keys, I use the left Windows key as that key, while my right Windows key acts as Compose/Multi_key.
However, I also have a couple of ([very] old) keyboards that don't have any Windows keys (i.e. they're winkeyless), and there I don't have any key left that I can (comfortably) use as my ‘WM control key’. In the past, because xMonad allowed that, I used Control+Alt as my ‘WM control key (combination)’, but as I noticed after some time, this interferes with (some) Emacs (movement commands), so this isn't an option anymore. Therefore, I thought that I could utilise my Escape key in the following way:
- If I hold down Ecs, it acts like Mod4
- If I tap Esc, it acts as Escape
AFAIK, holding down Escape doesn't really do anything normally, so I thought it might be a good idea to do it like this. I then tried to achieve this by using
clear Mod4 add Mod4 = Super_L Escape
What I expected: Super_L still acts as Super, and Escape is now an additional Super. The next step would have been to use
xcape to get (some) of the old Escape key behaviour back.
What I got (the output of
xmodmap: up to 4 keys per modifier, (keycodes in parentheses): shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Meta_L (0xcd) mod2 Num_Lock (0x4d), Hyper_L (0xcf) mod3 Scroll_Lock (0x4e), Mode_switch (0xcb) mod4 Escape (0x9), y (0x34), Super_L (0x85), Super_L (0xce) mod5 ISO_Level3_Shift (0x5c)
What I don't understand:
- Why is
ysuddenly set to Mod4, as well?
- Why does Escape still work as Escape (when pressed once) and Super (when held down; I noticed this when I tried to test my changes), although at this point I had not used
Is this a bug in
xmodmap, or am I using
xmodmap incorrectly? I suspect it's the latter, but could somebody help me with achieving what I'm trying to do?
Further info (hopefully not irrelevant):
- My current OS is Arch Linux
- I'm open to solutions that use other software, such as
- I'm currently using the German QWERTZ layout (i.e. ISO, not ANSI), and sometimes Neo (which, AFAIK is implemented as another variant of the
dekeymap/layout; see output of
- I want my solution to work keyboard/hardware independent: If I change my keyboard, I don't want to have to change any config files.
- Before anyone suggests this: Mapping Super to Capslock is not an option, as I sometimes use the Neo layout, which uses Capslock as one of its 3rd layer modifiers, and it's also used for the 5th and 6th layer. This also means that I'd like this solution to be keyboard layout independent, as well, so I can easily switch between, e.g. Neo and QWERTZ.
- I'm still open to other suggestions. My only demands: No/minimal interference with any other programs (e.g. Emacs or Vim), and the key (combination) to use as my ‘WM control key’ should be located on the left side of my keyboard, because most of the other keys I use to control my WM are on the right side of my keyboard (e.g. h, j, k, l,…).
Before any changes, i.e. my current situation,
xmodmap: up to 2 keys per modifier, (keycodes in parentheses): shift Shift_L (0x32), Shift_R (0x3e) lock Caps_Lock (0x42) control Control_L (0x25), Control_R (0x69) mod1 Alt_L (0x40), Meta_L (0xcd) mod2 Num_Lock (0x4d), Hyper_L (0xcf) mod3 Scroll_Lock (0x4e), Mode_switch (0xcb) mod4 Super_L (0x85), Super_L (0xce) mod5 ISO_Level3_Shift (0x5c)
add Mod3 = Scroll_Lock
System Locale: LANG=de_DE.UTF-8 LC_COLLATE=C VC Keymap: de-latin1-nodeadkeys X11 Layout: de,de X11 Model: pc105 X11 Variant: nodeadkeys,neo X11 Options: compose:rwin,grp:ctrls_toggle