How to change keyboard layout without a DE?
I am running X on Arch Linux without a desktop environment, only i3. Sometimes I need to switch between typing in different languages. How do I switch my keyboard layout?
1 answer
According to the keyboard layout wiki, keyboard configurations (for both the console and Xorg) can be conveniently set using the localectl
command.
In order to set a second keyboard layout, we have to dig into the manual page. There it is stated that a second layout (for the console) can be set up by specifying a "toggle keymap". Concretely, you can set a second keyboard layout for your console:
localectl set-keymap KEYMAP1 KEYMAP2
This will also set KEYMAP1
as the Xorg layout.
If you only need multiple keyboard layouts in your GUI, it should suffice to set the Xorg keymap using a comma-separated list of layouts using
localectl set-x11-keymap KEYMAP1,KEYMAP2
Additional arguments can be used to specify models and/or variants.
See the xorg keyboard wiki for further details.
This will also set KEYMAP1
as the console layout.
Note that if you want to have both, you will have to use both localectl
commands and specify --no-convert
for the second command.
Otherwise, the settings from the first command will be overwritten.
0 comment threads