I want to use my Apple long aluminium keyboard with swapped Command Cmd
and Control Ctrl
keys. How is this done step by step on Trusty Tahr (14.04) using xkb
?
Note: This solution doesn't work for me as xkb
replaced xmodmap
in 13.04 or even earlier.
Best Answer
This answer is mostly based on the answer given here. The reason I ask and answer this question again is the final step, which was not fully described. For further reading about
xkb
look here, here, and here.Create a file in
/usr/share/X11/xkb/symbols
(could also be in/etc/X11/xkb/symbols
) calledaltwin2
and containing the following mapping:Insert the following line under the
option = symbols
section in/usr/share/X11/xkb/rules/evdev
(disregard the warning on the first line):Add the new option to
/usr/share/X11/xkb/rules/evdev.lst
under the sectionoption
:If you don't know where your keyboard configuration file is, you can edit it using dconf-editor, adding
"altwin2:cmd_n_ctrl"
inxkb-options
under org::gnome::desktop::input-sources as shown here. If you know where your configuration file is, you should include the new option in theXkbOptions
field as shown below:Either reboot or restart
lightdm
to update the changes:NOTE: if any changes are made directly in the layout files, i.e. not using options, the cached files in
/var/lib/xkb/
need to be deleted as indicated here.