I've been looking for a way to solve the aforementioned problem.

I tried

xmodmap -e "keycode 66 = Alt_L"

but apparently the result is that the CapsLock key gets mapped to Left-SHIFT, which is not the intended behavior.
From my searches I understood that xmodmap is obsolete and I should use setxkbmap instead. However, I found it very hard to remap a key that is not part of the default options of xkb (e.g. I could map CapsLock to Left-CTRL but not to Left-ALT).

How can I use setxkbmap to achieve this goal?

  • Do you want CapsLock and LeftAlt to be swapped, or should LeftAlt now be an additional CapsLock, or do you want the CapsLock key have a different behaviour, or essentially be a dead key?
    – emk2203
    Aug 22, 2018 at 20:07
  • @emk2203 Thanks for your comment. I want CapsLock to be an additional LeftAlt
    – Daniel
    Aug 22, 2018 at 21:11

1 Answer 1


I started considering the solutions from here and here, but I couldn't make them work.

I found the solution here:


It achieves what I was looking for, although in a rather ugly way (I would very much prefer to create a new xkb option with this remap, but I couldn't make that work)


The solution above doesn't allow me to keep two different keys for LALT. Instead, I followed this guideline with the following symbol definition:

// This changes the <CAPS> key to become an Alt modifier,
// but it will still produce the Caps_Lock keysym.
hidden partial modifier_keys
xkb_symbols "alt" {
    replace key <CAPS> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ Caps_Lock ],
        actions[Group1] = [ SetMods(modifiers=Mod1) ]
    modifier_map Mod1 { <CAPS> };

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.