I'm trying to counter my "emacs pinky" by putting some keys in more accesible places. I've already switched Ctrl for Caps Lock, which was a no brainer, putting a setxkbmap command to the Startup Applications list.

I've decided that I should also move the left Meta/Super/Windows key, that I tend to use a lot and is not very comfortable to access in my keyboard. The best key to make its function would be the one above the Tab, that in american keyboards makes the ~ symbol (and in the ES keyboard makes the Masculine/Femenine symbols and the backslash, and ).

this is the key i'd like to swap with the left Meta key

I've figured out, looking at /usr/share/X11/xkb/symbols/es, that its code is TLDE:

key <TLDE>  { [ masculine, ordfeminine,    backslash,   backslash ] };

But how can I swap that key with the left meta key?? I can't find that key's code in xkb, and I've no idea how I can make swaps for which there is not an option in /usr/share/X11/xkb/rules/evdev.lst. Its code is LWIN (as I saw/usr/share/X11/xkb/symbols/pc):

key <LWIN> {      [ Super_L               ]       };

Were it relevant, I'm currently running XFCE4, but I'd like a portable solution so I can take it with me if I change DE (I use Unity in other computers); I'm also using an spanish keyboard.

Added: My current config; note I have swapcaps enabled, it's enabled from a setxkbmap I added to the startup applications.

$ setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+es+inet(evdev)+ctrl(swapcaps)"  };
    xkb_geometry  { include "pc(pc105)" };


A failed try that might be close

I tried changing the layouts in x11/xkb.

In /usr/share/X11/xkb/symbols/es:

-key <TLDE>        { [ masculine, ordfeminine,    backslash,   backslash ] };
+key <TLDE>        { [ Super_L ] };

In /usr/share/X11/xkb/symbols/pc:

-key <LWIN> {      [ Super_L               ]       };    
+key <LWIN> {     [ masculine, ordfeminine,    backslash,   backslash  ] };

It made no difference, they show the same behabiour.

Another idea

Another think I've thought about is switching the keycodes in /usr/share/X11/xkb/keycodes/evdev. Couldn't get it to work though.


using xmodmap

I didn't want to use xmodmap, but... it does the trick:

  1. xev to check keycode and function (for me, 49 is masculine-ord, 133 is Super_L).
  2. xmodmap to swap their functions:

    xmodmap -e 'keycode 49 = Super_L'
    xmodmap -e 'keycode 133 = masculine backslash backslash backslash'

Note that this responds to my keyboard layout, you should check for yours. Also, now the backslash is made with Shift instead of Alt-Gr like before, but didn't make me too long to get used to that.

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.