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
Add to ~/.config/openbox/lubuntu-rc.xml
:
<keybind key="W-space">
<action name="Execute">
<command>sh ~/scripts/toggle_keyboard_layout.sh</command>
</action>
</keybind>
openbox --reconfigure