1 #!/bin/sh 2 3 # switchs keyboard layout and updates dwmblocks 4 5 kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1 6 7 case $kb in 8 # us) setxkbmap es && dunstctl close-all && dunstify -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to ES";; 9 # es) setxkbmap us && dunstctl close-all && dunstify -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to US";; 10 us) setxkbmap -option altwin:swap_lalt_lwin,altwin:swap_alt_win,ctrl:nocaps es && dunstify -r 1 -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to ES π¦π·";; 11 es) setxkbmap -option altwin:swap_lalt_lwin,altwin:swap_alt_win,ctrl:nocaps us && dunstify -r 1 -t 2000 -h "string:bgcolor:#111111" "Switched keyboard layout to US πΊπΈ";; 12 esac 13 14 pkill -RTMIN+4 dwmblocks