1

I have done quite a lot of research on how to swap the Escape and Caps Lock keys. I achieved it while using X11 via my .xinitrc file and the following line of code:

setxkbdmap -option caps:swapescape

However, when I start a tty, it doesn't work. How can I get this to work while using a tty? Is it possible to use some kind of global option, like a custom keyboard layout that does not depend on X11?

I'm using Arch Linux, if that helps.

1 Answers1

0

Step by step solution

X11

The following command sets the X11 keyboard correctly (de is my keyboard layout):

localectl --no-convert set-x11-keymap de "" "" caps:swapescape

tty

The tty keyboard can be configured as follows:

  1. Copy the correct keyboard layout file to a custom directory:

cp /usr/share/kbd/keymaps/i386/qwertz/de-latin1.map.gz /usr/local/share/kbd/keymaps

(You will have to change that command depending on what keyboard layout you are using)

  1. Change every occurency of Escape to Caps_Lock and every occurency of Caps_Lock to Escape in the copied file and rename it to something like de-latin1-custom.map.gz

  2. Edit the /etc/vconsole.conf file to look like this:

KEYMAP="/usr/local/share/kbd/keymaps/de-latin1-custom.map.gz"

After rebooting the system the keyboard should be configured correctly for X11 and for tty.