1

I have just upgraded from Fedora 14 with Gnome desktop to Fedora 20 with Mate desktop. Under F14, I previously swapped CapsLock with Control_Left, and Alt_Right with Control_Right. These I did by adding the following lines to /etc/X11/xinit/xinitrc-common (excuse the 'xmodmap's on each line)

xmodmap -e 'clear lock'
xmodmap -e 'clear control'
xmodmap -e 'remove mod1 = Alt_R'
xmodmap -e 'add control = Caps_Lock Alt_R'
xmodmap -e 'add mod1 = Control_R'
xmodmap -e 'add lock = Control_L'

Under F14, they work as expected. However, when I copy these to /etc/X11/xinitrc-common under F20, the CapsLock Control_L swap does not happen. Instead, both keys become CapsLock. The Alt_R/Control_R swap does work correctly.

Next, I tried the solution offered in the xmodmap man page, and also here: Remapping Caps Lock with xmodmap doesn't work

xmodmap -e 'remove Lock = Caps_Lock'
xmodmap -e 'remove Control = Control_L'
xmodmap -e 'keysym Control_L = Caps_Lock'
xmodmap -e 'keysym Caps_Lock = Control_L'
xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'add Control = Control_L'

Strangely, CapsLock and Control_L keys are now both Control_L.

Doing all swaps with keycode mappings works like a charm though:

xmodmap -e 'clear Lock'
xmodmap -e 'clear Control'
xmodmap -e 'remove Mod1 = Alt_R'
xmodmap -e 'keycode 66 = Control_L'
xmodmap -e 'keycode 37 = Caps_Lock'
xmodmap -e 'keycode 108 = Control_R'
xmodmap -e 'keycode 105 = Alt_R'
xmodmap -e 'add Lock = Caps_Lock'
xmodmap -e 'add Control = Control_L Control_R'
xmodmap -e 'add Mod1 = Alt_R'

The original keycodes before the swap are 66=CapsLock, 37=Control_L, 108=Alt_R, 105=Control_R.

I would like to understand why the first two methods would not work. Any ideas?

0

I had a similar issue when I tried to switch the right control key and the menu key on a laptop (Dell swapped their physical position on the keyboard).

For some reason, the modifier keys have to have two things in place to work. It needs to know that a particular key is Control_R, and it needs to know that the particular key has the Control modifier attached to it.

So I had to swap the keycodes, and then separately remove control function from one key and add it to another. I only needed to do the first step when I experimented with swapping letter keys.

My guess is that the modifier functions are just handled differently by the system.

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.