Remapping the key Caps Lock as Ctrl on GNU/Linux
This is about remapping the key Caps Lock
as Ctrl
.
I looked around the web and found a few ways to do it; editing XKBOPTIONS
worked on my system (i.e. GNU/Linux Trisquel, Xfce). I have no idea whether this is the best way.
To remap the key, I appended ctrl:swapcaps
to XKBOPTIONS
in the file /etc/default/keyboard
I went from this:
XKBOPTIONS="grp:toggle,grp_led:scroll"
to this:
XKBOPTIONS="grp:toggle,grp_led:scroll,ctrl:swapcaps"
Then I ticked the checkbox Use system keyboard layout
, if you hover you’ll see the XKB
acronym (prepending XKBOPTIONS
).
What is XKBOPTIONS?
From the manpages of keyboard:
[XKBOPTIONS] specifies the XKB keyboard option components. Options usually relate to the behavior of the special keys (
Shift
,Control
,Alt
,CapsLock
, etc.) Default: not set.
Also see from the section title EXAMPLES:
The following configuration will give you the standard US QWERTY layout (us). The key
Menu
will act as a compose key (compose:menu) andCapsLock
, will act as third control key (ctrl:nocaps).XKBLAYOUT=us
XKBVARIANT=
XKBOPTIONS=compose:menu,ctrl:nocaps
In this example, you can see that if you want to keep the behaviour of the key left Ctrl
as it is, you can try appending XKBOPTIONS
with ctrl:nocaps
(instead of ctrl:swapcaps
. I have not tried myself).
Note: you need to edit the configuration file with sudo:
$ sudo vi /etc/default/keyboard
or
$ sudo nano /etc/default/keyboard
Source: keyboard manpage.
personal computing command-line interface (cli) gnu linux trisquel shell literacy wiki xfce