added language switch

This commit is contained in:
Shihaam Abdul Rahman 2022-08-20 20:27:52 +05:00
parent ecaade6541
commit 6f55fa414d
Signed by: shihaam
GPG Key ID: 3B007D22E5584980

10
scripts/switch-lang Executable file
View File

@ -0,0 +1,10 @@
#!/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"