I am doing a task that is taking me longer than expected as xmodmap cannot be combined with other commands such as setxkbmap and so on. My goal is to change Right_Control key from been assigned on control to mod3 as per xmodmap terminology

Thanks to this post I was able to assign it to that key : Use setxkbmap to swap the Left Shift and Left Control

The problem is that now I still have assigned Right_Control to "control" , and I need to remove this assignment

To sum up the steps I have followed:

(note that I have previously used fa as my custom layout I already have files in /usr/shareX11/xkb/symbols/fa and etc...)

mkdir -p ~/.xkb/symbols/keymap
mkdir -p ~/.xkb/symbols/
sudo vi ~/.xkb/symbols/assigningmod3


partial modifier_keys
xkb_symbols "assign_rctl_to_mod3" {
    modifier_map Mod3 { <RCTL> };


setxkbmap -print > ~/.xkb/keymap/fa
sudo vi ~/.xkb/keymap/fa

And added the underlined part to it

xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+fa+inet(evdev)+assigningmod3(assign_rctl_to_mod3)"  };
    xkb_geometry  { include "pc(pc105)" };     ----------------------------------

Then include this line in my .xinitrc

xkbcomp -I$HOME/.xkb ~/.xkb/keymap/fa $DISPLAY 2> /dev/null

Restarting now my X11Server The issue now Is that when I check for the assignments xmodmap I have

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)
mod3        Control_R (0x69)
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

As you can see I have underlined the assignment I need to still remove , in the other hand mod3 has been assigned correctly. If I trace where I may have to modify it be to the original assignment of the key at /usr/share/X11/xkb/symbols/level3 line no92

xkb_symbols "switch" {
  key <RCTL> {
    symbols[Group1] = [ ISO_Level3_Shift ]
  include "level3(modifier_mapping)"

But I don't really feel confindent on tweaking anything on there. You know how to assign this?

1 Answer 1


Although you may experience some issue when invoking xmodmap to load whole templates files. It is perfectly fine to delete this key-assignment by using xmodmap on .xinitrc by just adding below xkbcomp invokation the following line

/usr/bin/xmodmap -e 'remove control = Control_R'

You must log in to answer this question.

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