Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save epiphone/ecebb2e6d8f3124a2a5fc714b76aa203 to your computer and use it in GitHub Desktop.
Save epiphone/ecebb2e6d8f3124a2a5fc714b76aa203 to your computer and use it in GitHub Desktop.
Keyboard layout toggle hotkey in Lubuntu

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment