I have ubuntu (11.04) running on a recent macbook pro. I use both the built in keyboard and an external keyboard. I want to remap capslock on both keyboards to super, and I want to swap left-alt (mac option) and left-super (mac cmd) on the built in (apple) keyboard only.
Xmodmap can't configure multiple keyboards differently, so thats out.
I am able to do this from the cli via setkbmap. Here is the script I'm using:
#!/bin/sh
#set caps to super
setxkbmap -option caps:super
#swap command and option for apple keyboard
setxkbmap -device `xinput list | grep -o -P 'Apple Internal Keyboard / Trackpad\s+id=\d+' | grep -o -P '\d+'` -option altwin:swap_lalt_lwin
If I have to, I can run this as a startup application, but I would really like to know if there is a configuration file I can add these settings to instead.
It looks like I should be able to add an option (XkbOptions) to the inputdevice section of my xorg.conf, but when I tried this, the settings had no affect (perhaps gnome overrides the X settings?). I also tried adding a new inputclass to xorg.conf but that didn't work either.
What is the correct place to configure multiple keyboards with different key bindings?
/etc/default/keymap(Debian) or/etc/X11/xorg.conf.d/00-keyboard.conf(Fedora) to avoid the on-resume problem, but it may not work for multiple keyboards with different options (on both OSes, this is used to specify the console keymap as well as the X keymap, and thus is somewhat restricted). – dhardy Feb 17 '14 at 11:38