#!/bin/sh layout="$(setxkbmap -query | awk '$1 ~ /layout/ { print $2 }')" alt_layout="${ALT_KB_LAYOUT?Alternative layout not set!}" echo "$layout" case $layout in us) setxkbmap -layout "$alt_layout" notify-send "Layout Changed." "Keyboard set to $alt_layout." ;; *) setxkbmap -layout us notify-send "Layout Changed." "Keyboard set to us." ;; esac