2

I've been attempting to switch my super and control keys in X on a macbook and have been half successful. I'd like to avoid creating a custom .Xmodmap if possible, as there is a temporary 100% cpu bug that pops up every time the custom map is loaded (not to mention various warnings against using xmodmap generally which I've come across).

After some diging, I ended up putting Option "XkbOptions" "altwin:ctrl_win" in my 01-keyboard-layout.conf file which has gotten me halfway there: for eg, left command now maps to 133 Control_L. However, the control keys remain the same. Left control, for eg still maps to 37 Control_L.

Looking through evdev.lst (and a bunch of googling) turned up no relevant XkbOption for turning control keys into supers, and now i'm pretty stuck.

I'm now looking through the insanity that is Doug Palmer's An Unreliable Guide to XKB Configuration but it is, as he describes, a descent into hell.

anyone who's attempted this switchover before and knows the exact rules/symbols/keymaps to get it done, your assistance would be great.

Thanks!

2 Answers 2

1

The following solution is simpler than the Asker's. (Tested on Ubuntu 14.04 running on a Dell.)

1) In the file /usr/share/X11/xkb/keycodes/evdev, swap the scan codes (numbers) of the keys you want swapped. NOTE: your hardware may target a different keycode file than evdev.

2) Run sudo rm /var/lib/xkb/*.xkm to clear the xkb cache, then reboot.

0

Ok, I did finally get this to work.

First, these two resources are amazing for anyone wanting to delve into this mess:

http://madduck.net/docs/extending-xkb/ & http://www.charvolant.org/~doug/xkb/html/index.html

For anyone specifically trying to do this switchover, this is what I did:

1) create a file in /usr/share/X11/xkb/symbols for your new mapping 2) put this in it:

// Control is SWAPPED with Win-keys 
partial modifier_keys
xkb_symbols "cmd_n_ctrl" {
    key <LWIN> {        [       Control_L               ]       };
    key <RWIN> {        [       Control_R               ]       };
    key <LCTL> {       [       Super_L         ]       };
    modifier_map Control { <LWIN>, <RWIN> };
    modifier_map Mod4 { <LCTL> };
};

3: edit evdev in /usr/share/X11/xkb/rules to include:

altwin2:cmd_n_ctrl               =       +altwin2(cmd_n_ctrl)

(under the option = symbols section)

4: add your new option to evdev.lst (same dir):

altwin2:cmd_n_ctrl

(under the option section)

5: now edit your 01-Keyboard conf file to include the new option that you've created. Mine looks like this:

Section "InputClass"
        Identifier "keyboard-layout"
        Driver "evdev"
        MatchIsKeyboard "yes"
        Option "XkbLayout" "us, ru, ca, fr"
        Option "XkbOptions" "altwin2:cmd_n_ctrl"
EndSection

6: reboot and you should be good to go.

The above resources are way better at explaining all of this, or any snags you might run into. There is probably a much better way to do this (probably not altering the contents of /usr/share), but so far, this is what got me up and running.

Hope that helps someone else stuck in this spot!

You must log in to answer this question.

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