This article: https://wiki.archlinux.org/title/xmodmap#Reassigning_modifiers_to_keys_on_your_keyboard

Has an example:

clear lock
clear control
add control = Caps_Lock Control_L Control_R
keycode 66 = Control_L Caps_Lock NoSymbol NoSymbol

That maps caps_lock physical to the function control and physical shift + caps_lock to the function caps_lock. My problem is that I don't know how this example works.

My intuitive (but incorrect) understanding of how these lines should work is:

you clear the lock/control modifiers. I naively think that lock means caps lock but this is probably incorrect.

Then the add control = Caps_Lock Control_L Control_R means 'the keysyms Caps_Lock Control_L and Control_R will trigger the control modifier.

Then the last line: keycode 66 = Control_L Caps_Lock NoSymbol NoSymbol should mean (in my head but not in reality) map the physical key with keycode 66 (the physical caps lock key) so that alone it gives keysym Control_L (triggering the control modifier per the previous line), and shift+keycode 66 should (and here's where I'm confused) also just trigger the Caps_Lock keycode, and therefore the control modifier.

I've experimented with various modifications to this with further unexpected results.

I find the documentation for xmodmap (both in the manpage and archwiki) to be terse and unhelpful.

So I am wondering if someone could explain what's going on with this code. Also the functions of the control and lock modifiers because I've realized that the lock modifier is not just caps lock.

I know that XKB is the recommended config tool now, and that doing complicated things with xmodmap is discouraged so maybe this is just one step too far.

1 Answer 1


Read this Linux: xmodmap Tutorial, and maybe this topic and you will understand it better.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .