I switched from SUSE recently, which uses KDE as a default desktop environment. In KDE, it is possible to archieve such a setup with GUI options, but not in XFCE.

I've tried set up the ~/.Xmodmap file the following way:

clear Lock
clear Control
clear Mod2 
clear Mod5 
keycode  77 = Caps_Lock Num_Lock Caps_Lock Num_Lock
keycode  66 = ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift ISO_Level3_Shift
keycode  37 = Control_L NoSymbol Control_L NoSymbol Multi_key Multi_key 
add Control = Control_L Control_R
add Lock = Caps_Lock
add Mod2 = Num_Lock
add Mod5 = ISO_Level3_Shift

What happens:

  • Caps Lock functionality goes to Num Lock
  • Num Lock functionality goes to Shift + Num Lock

What I expected to happen, but it did not:

  • Caps Lock button should be ISO_Level3_Shift (it is, according to xev, but it has the functionality of usual Shift somewhy)
  • Pressing Caps Lock + Left Ctrl should act as Compose key (does not work).

What am I doing wrong? Xubuntu 18.04, fresh installation

  • If you did it in KDE using system settings, it's probably easier to do it via xkb options. Please tell us how you did it in KDE. – danzel Jun 19 '18 at 15:54
  • Seems that you put the compose key on the fifth and sixth level, not the third level: keycode 37 = Control_L NoSymbol Control_L NoSymbol Multi_key Multi_key . Shouldn’t it be something like: keycode 37 = Control_L NoSymbol Multi_key …? – Guildenstern Mar 14 '19 at 16:33

Map the third level shift to <CAPS> (caps lock) and use the third level of left control as the compose key (Multi_key):

setxkbmap -option compose:lctrl-altgr \
    -option lv3:caps_switch \
    -layout "us(intl)"

For the numlock key you can make a symbols file as a wrapper for whatever layout you are using (I am going to use us(intl)). Make a symbols file named custom :

xkb_symbols "basic" {

    // The layout that you want to use.
    include "us(intl)"

    key <NMLK> { [
        Caps_Lock, Num_Lock, Caps_Lock, Num_Lock
    ] };


Save the custom file in a directory tree which mirrors the structure of /usr/share/X11/xkb. So if your directory is stored at /home/<user>/my-xkb/, the custom file should be at /home/<user>/my-xkb/symbols/custom.

(See here for general instructions on how to make and use custom Xkb files.)

Instead of just using setxkbmap you’re going to have to use the -print option in order to pipe the output to xkbcomp. xkbcomp has the -I option which you’ll use to give the path to your custom Xkb directory tree.

setxkbmap -option compose:lctrl-altgr \
    -option lv3:caps_switch \
    -layout "custom" \
    -print |
        xkbcomp -I"/home/<user>/my-xkb" \
            - "$DISPLAY"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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