A method for switching keyboard layouts with a hotkey other than the ones in man xkeyboard-config
. Here I'm switching between us
/fi
with Super + space
.
Create a script in ~/scripts/toggle_keyboard_layout.sh
:
LAYOUT=$(setxkbmap -print | awk -F"+" '/xkb_symbols/ {print $2}')
if [ $LAYOUT = "us" ]; then
setxkbmap -layout fi
else
setxkbmap -layout us
fi