Let’s say you have 3 languages on your linux machine: English, Russian and Belarusian. You frequently switch between EN and RU. Sometimes you write something in EN and BY. So you don’t want to press Alt+Shift three times constantly, only when writting something in Belarusian.
1 2 3 4 5 6 7 8 9 10 11 #!/bin/bash current=`setxkbmap -query | grep layout|cut -d ',' -f 2` echo $current if [ "$current" == "by" ] then notify-send -t 500 -i keyboard "Keyboard layouts: US/RU" setxkbmap -model pc105 -layout us,ru -variant altgr-intl, -option grp:alt_shift_toggle else notify-send -t 500 -i keyboard "Keyboard layouts: US/BY" setxkbmap -model pc105 -layout us,by -variant altgr-intl, -option grp:alt_shift_toggle fi Here I assume that Alt+Shift switches languages inside a group....