2

On a standard US keyboard, I've swapped Caps Lock and Left Control, which is almost essential for proper Emacs usage.

For symmetry, I'd like to swap ' (the quote key) to Right Control. xkb seems like the tool to do this, but there's a whole lot of complexity with rules files, groups, etc. that I can't get my head around.

Can I see an example of how this would be done? I'm guessing that there's some special complexity about trying to turn a non-modifier key into a modifier key.

don_crissti
  • 82,805

1 Answers1

3

The easiest way is to edit /usr/share/X11/xkb/keycodes/evdev and swap keycodes, e.g. on my system the keycode for quote key is 48 and respectively 105 for the right ctrl so just comment the original lines (prepend //) and swap values:

//    <AC11> = 48;
    <AC11> = 105;
    ...........
//    <RCTL> = 105;
    <RCTL> = 48;

A better way would be to add a new option to your /usr/share/X11/xkb/symbols/ctrl e.g.

partial modifier_keys
xkb_symbols "swapquotes" {
    replace key <AC11> { [ Control_R ] };
    replace key <RCTL> { [ apostrophe,  quotedbl ] };
};

that you could then load/unload via setxkbmap. If you use this method you may want to list the new option along with a short description in your evdev.lst (see the post here for more details).

don_crissti
  • 82,805