Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Ctrl-W or Ctrl-S.

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

share|improve this question
I'd switch CAPS LOCK with ctrl. – artifex Mar 5 '10 at 8:53
up vote 5 down vote accepted
  • 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.

share|improve this answer
Those changes might not persist if keyboard layout is switched. The easiest solution I have found is to swap codes globally in the /usr/share/X11/xkb/keycodes/evdev file. – Alex Fedulov Sep 20 '15 at 9:21

You can get pretty close by means of KDE settings only:

Go to KDE's system configuration, then go to "input devices" in the "hardware" section. In this window, make sure you have selected "keyboard" on the left, then open the "advanced" tab. There we are, keeping in mind that you can select and combine the options, this allows for a very flexible setup.

  1. Placing Ctrl on the Windows key and keeping the alt keys as they are:
    • Behavior of the Alt and Windows keys:
      • Enable: Ctrl is placed on the Alt keys, Alt on the Windows key.
  2. Swapping Ctrl and Alt keys, although you lose the AltGr key:
    • Behavior of the Alt and Windows keys:
      • Enable: Ctrl is placed on the Alt keys, Alt on the Windows key.
    • Position of the Ctrl key:
      • Enable: Right Ctrl as Alt key.

PS: I'm answering in this old question because it showed up first when I googled it.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .