undoIT said: That explains to me better why it is good to keep Ctrl mapped to the control key, since beyond what is printed on the keys, there is actually a scancode for each key. It is just too bad that Apple decided to make the scancode for the command key the same as the Winkey and that they called the label the other key "control".
in fact, it was Mircosoft to 'invent' the Win key, not the other way around. and control emits the scancode intended for control. that's correct.
however, to get (again) more technical, it seems like there are 2 approaches conceivable:
- patch the kernel driver to emit swapped keycodes. that's easy to accomplish, but very unlikely to get accepted upstream.
- hack the X keysym definition one more time.
i chose to try the latter one... and it turned out, that it's not that difficult. here we go:
- unpack and copy the attached file to /usr/share/X11/xkb/symbols/. ideally this stuff should be added to the ctrl file, but it's easier in a separate file and won't be clobbered by upgrades. please also note that by default this file does nothing.
- add the second line below in /usr/share/X11/xkb/rules/base between the other two (at line 884), so it looks like this:
! option = symbols
altctrl:super_ctrl = +altctrl(super_ctrl)
grp:shift_toggle = +group(shifts_toggle)
now the following line should activate a keyboard layout with both command and control keys swapped similar to the xmodmap script i posted earlier:
setxkbmap -v -model pc105 -layout de -variant mac -option -option altctrl:super_ctrl -option altwin:ctrl_win
replace the layout (de) and the variant (mac) with whatever you like. not all layouts have the same variants. have a look at /usr/share/X11/xkb/symbols/<your language> to get the variants available. 'mac' is usually defined.
please also note that in the above command '-option' comes twice by intention. to revert back to the previous setting, use the same command without the last two options (-option altctrl:super_ctrl -option altwin:ctrl_win) or restart X.
having a symbols fragment like this now allows to easily add a switch to GNOME keyboard properties. in fact, the others work like this as well. have a look at the list at the very end of /usr/share/X11/xkb/rules/base. feel free to send it upstream if you like it (and it works ;-)).
ciao, Mario
EDIT: sorry, undoIT for finding a solution. i did expect much more troubles while writing my previous posts. but on the other hand, i thought about it while driving home and felt like i had to try that since i (tried to) understand this keyboard stuff once before.