Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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