How do you remap a key to the Caps Lock key in Xubuntu?

Another way:

sudo vi /etc/default/keyboard

then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key or ctrl:swapcaps to swap Caps Lock and Control.

For example, mine looks like

XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"

then run

sudo dpkg-reconfigure keyboard-configuration

The reason this way is better is that it will take effect on the virtual consoles (e.g. Ctrl+Alt+F1) as well as in the graphical desktop.


To swap the keys go:

XubuntuSettings ManagerSession and Startup

Then in the Sessions and Startup configurator go

Application Autostart (tab at the top) → Add (bottom button)

Now on the Add Application screen

  • Name: Control and CapsLk swap
  • Description: Swap the two keys
  • Command: /usr/bin/setxkbmap -option "ctrl:swapcaps"

To remap Caps Lock to Control go:

Xubuntu → Settings Manager → Session and Startup

Then in the Sessions and Startup configurator go

Application Autostart (tab at the top) → Add (bottom button)

Now on the Add Application screen

Name: Remap CapsLk to Ctrl
Description: Remap the CapsLk key to Control
Command: /usr/bin/setxkbmap -option "ctrl:nocaps"

For compose instead of caps put compose:caps as the -options parameter.

Tags:

Xubuntu