dotfiles/scripts/switch-lang

11 lines
307 B
Plaintext
Raw Permalink Normal View History

2022-08-20 20:27:52 +05:00
#!/bin/bash
LAYOUT_OLD=$(setxkbmap -query | grep layout | cut -d ':' -f 2)
LAYOUT_NEW=$(grep -A 1 $LAYOUT_OLD $HOME/.config/keyboard_layout | tail -n1)
if [ "$LAYOUT_NEW" = "END" ]
then
LAYOUT_NEW=$(head -n1 $HOME/.config/keyboard_layout)
fi
setxkbmap $LAYOUT_NEW
notify-send "New Layout $LAYOUT_NEW set"