Grouped keyboard layouts or cycle the last two (Mint 19)
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Grouped keyboard layouts or cycle the last two (Mint 19)
I have multiple keyboard layouts (ru,cz,en). Is there any possibility to group layouts and switch between groups? Let's say group 1 is ru only, group 2 is en+cz and switch between groups via alt+shift and switch within a group via ctrl+shift (en/cz). It also would be ok to cycle the last two layouts (like ubuntu layout-switch), but i didn't found that option in xkb. I've found several bash scripts but none of them worked in Mint 19 (cycling the last two layouts). Cycling all three layouts all the time is just pure pain...
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Grouped keyboard layouts or cycle the last two (Mint 19)
Well, ok, since it's linux, so... help yourself solution here with cycling 2 keyboard layouts is:
1. Install xkb-switch (https://github.com/ierton/xkb-switch)
2. Make bash script
Place this inside (modify for your needs):
3. Make script executable
4. Test
It should toggle your layouts
5. Go to keyboard settings and change Alt+Shift toggling to anything else (e.g. Shift+CapsLock)
6. Make new shortcut in keyboard settings with command "xkb-toggle-en-ru" and assign Alt+Shift to it.
Done.
1. Install xkb-switch (https://github.com/ierton/xkb-switch)
Code: Select all
sudo apt install cmake libxkbfile-dev build-essential
git clone https://github.com/ierton/xkb-switch.git
cd xkb-switch
mkdir build && cd build
cmake ..
make
sudo make install
sudo ln -s /usr/local/lib/libxkbswitch.so.1 /usr/lib/libxkbswitch.so.1
Code: Select all
sudo vim /usr/local/bin/xkb-toggle-en-ru
Code: Select all
#!/bin/bash
LANG1="us"
LANG2="ru"
CURRENT_LANG=$(xkb-switch)
if [ "$CURRENT_LANG" = $LANG1 ]; then
xkb-switch -s $LANG2
else
xkb-switch -s $LANG1
fi
Code: Select all
sudo chmod +x /usr/local/bin/xkb-toggle-en-ru
Code: Select all
xkb-toggle-en-ru
5. Go to keyboard settings and change Alt+Shift toggling to anything else (e.g. Shift+CapsLock)
6. Make new shortcut in keyboard settings with command "xkb-toggle-en-ru" and assign Alt+Shift to it.
Done.