Swapping CapsLock and LeftCtrl

Reconfiguring the CapsLock key

Some folks prefer the Left Control key just to the left of the A key on their keyboards. If this is you, read on.

Linux

If you are the only user of your machine, you can edit /etc/default/keyboard and add or change the XKBOPTIONS line so it reads as:

    XKBOPTIONS="ctrl:swapcaps"

[I don't think this affects X sessions, so there is more to do.]

XFCE4

If you share your machine with others, change the keyboard mapping in your own account. Under the Xfce4 desktop environment (Xubuntu), open the Session and Startup settings in your Settings menu or System Settings application (xfce4-settings-manager).

Session and Startup settings

Select the Application Autostart tab and click Add
button and the application configuration dialog opens:

Add Application entry dialog

Fill in the fields:

  • Name: Swap CapsLock/LCtrl
  • Description: swap CapsLock and LeftCtrl
  • Command: /usr/bin/setxkbmap -option "ctrl:swapcaps"

This creates a file in $HOME/.config/autostart called Swap CapsLock-Ctrl.desktop that contains:

    [Desktop Entry]
    Encoding=UTF-8
    Version=0.9.4
    Type=Application
    Name=Swap CapsLock/Ctrl
    Comment=swap CapsLock and Left-Ctrl
    Exec=/usr/bin/setxkbmap -option "ctrl:swapcaps"
    OnlyShowIn=XFCE;
    StartupNotify=false
    Terminal=false
    Hidden=false

Variations

If ctrl:swapcaps does not tweak your keyboard as you like, read the manual page for keyboard(5):

    man keyboard

In its FILES sections it suggests looking at /usr/share/X11/xkb/rules/xorg.lst for a complete list of options. Here are some of them:

ctrl:nocapsCaps Lock as Ctrl
ctrl:lctrl_metaLeft Ctrl as Meta
ctrl:swapcapsSwap Ctrl and Caps Lock
ctrl:ac_ctrlAt left of 'A'
ctrl:aa_ctrlAt bottom left
ctrl:rctrl_raltRight Ctrl as Right Alt
ctrl:menu_rctrlMenu as Right Ctrl
ctrl:swap_lalt_lctlSwap Left Alt with Left Ctrl
ctrl:swap_lwin_lctlSwap Left Win with Left Ctrl
ctrl:swap_rwin_rctlSwap Right Win with Right Ctrl
ctrl:swap_lalt_lctl_lwinLeft Alt as Ctrl, Left Ctrl as Win, Left Win as Left Alt

Receive Updates

ATOM

Contacts