KDE – How to Swap CTRL and ALT Keys

kdekeyboard shortcutskeyboard-layoutlinux

Does anyone know how to swap the Ctrl and Alt keys in KDE?

To me it seem like the Alt key is better positioned to be used more often for stuff like the CtrlW or CtrlS.

There is no way to press the Ctrl key without taking my fingers off of the home row.

Best Answer

  • Run setxkbmap -print | xkbcomp -xkb -o original.xkb -.
  • Then copy original.xkb to switch-LALT-LCTL.xkb. Keep the file original.xkb as a backup, better remove write permission.
  • Edit switch-LALT-LCTL.xkb in the block xkb_keycodes and exchange the keycodes for LALT and LCTL.
  • Run xkbcomp switch-LALT-LCTL.xkb $DISPLAY to active your new layout. Run xkbcomp original.xkb $DISPLAY to restore the old one.

These instructions suffice for modification on any level of sophistication. The keyboard description file is just structured text, after all.