I'm trying to disable Capslock and make the following remaps:
Ctrl+Capslock => Capslock
Alt+Capslock => Escape (since my Escape key is broken)
Right now I'm trying to use Xmodmap.
I have only the following:
keycode 66 = NoSymbol Caps_Lock
This disables Capslock and maps Shift+Capslock to Capslock, but what I want is Ctrl+Capslock instead of Shift+Capslock.
I have no idea how to map Alt+Capslock to the Escape key.
I want to clarify that I don't need an answer to use Xmodmap, any method will be fine.
Best Answer
Xmodmap cannot do what you're asking for, but it can bring you close.
The basic syntax for modifying the behavior of a key is
where
KEYSYMBOL2
gets triggered when pressing the key while pressing Shift.KEYSYMBOL3
gets triggered when pressing the key while pressing ModeSwitch.KEYSYMBOL4
gets triggered when pressing the key while pressing Shift + ModeSwitch.KEYSYMBOL1
gets triggered when pressing the key with none of the above.We can't set Ctrl or Alt to be the ModeSwitch key, since no key can serve as two different modifiers.
However, we can turn CapsLock into the ModeSwitch key:
To remap CapsLock + Ctrl to the CapsLock key, execute the following commands.
Note the CapsLock is the modifier key here, so you have to press this key first.
We can't remap CapsLock + Alt or CapsLock + Super to Escape in the same manner, since Alt and Super serve different functions when pressed alone and when used as modifier keys.
Every other key will work fine. Examples:
For CapsLock + ` (standard US layout), use
For CapsLock + Space, use
Tips:
To make the remappings permanent, create/edit the file
.gnomerc
in your home folder and save the corresponding commands in it.To undo all remappings, simply execute