I have 3 keyboard layouts on my laptop. One is rarely used, so i wrote a small script to add and remove it as needed. Here is the script content:

LAYOUT=`gsettings get org.gnome.desktop.input-sources sources`

if [ "$LAYOUT" != "[('xkb', 'us'), ('xkb', 'ru'), ('xkb', 'ara')]" ]; then
   gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ru'), ('xkb', 'ara')]"
   gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ru')]"

exit 0

It works, but sometimes even if Arabic layout added, and i can switch to it, when i enter something on my keyboard, it still types in English, even though the indicator shows Arabic. Restarting gnome shell with Alt+F2, r doesn't help and even logout/login doesn't help either. Reboot helps, and everything starts to work as it supposed to be. How can i debug the issue and fix it? Also, if i'm doing add/remove keyboard layout by hotkey somehow wrong, and there is a better way, advice will be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.