I use Arch Linux with
bspwm as my window manager and
sxhkd as a hotkey daemon. I want to map a certain key combination in my sxhkdrc so that it shuffles through different keyboard layouts. For example:
# Shuffle through keyboard layouts super + e *action to be executed*
First, I do not know whether I am required to add Serbian locales as I only (from time to time) want to activate the Serbian keyboard layouts. My thinking is that keymaps are enough. Just in case, I generated Serbian locales; so now when I run
localectl list-local, the output is:
en_US.UTF-8 sr_RS.UTF-8 sr_RS.UTF-8@latin
These respectively correspond to:
- English locale for the U.S. – UTF-8 encoding
- Serbian locale for Serbia – Cyrillic script – UTF-8 encoding
- Serbian locale for Serbia – Latin script – UTF-8 encoding
The three layouts I want to use (be able to shuffle through) are:
us= US English
sr-cy= Serbian in Cyrillic script
sr-latin= Serbian in Latin script
I know that I can edit
/etc/vconsole.conf and set
KEYMAP=sr_cy instead of
us or use
localectl set-keymap sr_cy.
Here are my concerns with that:
- It is not an elegant solution.
- I cannot shuffle through different layouts. I have to run the command and specify the desired layout each time.
- Would such change persists globally even after I log out or reboot the system? If the answer is yes, I will potentially be in trouble. I use LVM on LUKS encryption and for me to decrypt my disk I need
uslayout. Hence, if I forget to switch from Cyrillic script before rebooting, it's bye bye forever.
Is there any way for me to add multiple keymaps in
/etc/vconsole.conf and have the
us be the default one? If so, what do I need to do to switch between them. Is it a simple command or do I need a small script? If that is not an option, what is the best way to get to my end goal.
I have tried finding the answer to having multiple keymaps but I was not able to find anything applicable to my problem. I would appreciate a solution or even advice and suggestions especially if it advances my knowledge. Thank you in advance!