Skip to content

Instantly share code, notes, and snippets.

@matasarei
Last active April 24, 2019 21:11
Show Gist options
  • Select an option

  • Save matasarei/579991cfab9f5e7f966c7a424e5fa4c3 to your computer and use it in GitHub Desktop.

Select an option

Save matasarei/579991cfab9f5e7f966c7a424e5fa4c3 to your computer and use it in GitHub Desktop.
Switch layout with Super + Space and fix keyboard layout lag on elementaryOS Juno

HOWTO: Switch layout with Super + Space and fix keyboard layout lag on Juno

  1. sudo wget https://gist.githubusercontent.com/matasarei/579991cfab9f5e7f966c7a424e5fa4c3/raw/87037b9776a86ffd3dd2b32432bed9d5509da2d8/switch-layout.sh -O /usr/bin/switch-layout
  2. sudo chmod +x /usr/bin/switch-layout
  3. Go to keyboard settings
  4. Add custom keyboard shortcut switch-layout and set any combination, like Super + Spase.
#!/bin/sh
LAYOUT_COUNT=$(gsettings get org.gnome.desktop.input-sources sources | grep -oE "'[a-z]{2}'" | wc -l)
CURRENT_LAYOUT=$(gsettings get org.gnome.desktop.input-sources current)
CURRENT_LAYOUT_NUMBER=$(echo -n $CURRENT_LAYOUT | tail -c 1)
DESIRED_LAYOUT=$(expr $CURRENT_LAYOUT_NUMBER + 1)
if [ `expr $DESIRED_LAYOUT % $LAYOUT_COUNT` -eq 0 ] || [ '--set-default' = "$1" ] || [ '-d' = "$1" ]
then
DESIRED_LAYOUT="0"
fi
gsettings set org.gnome.desktop.input-sources current $DESIRED_LAYOUT
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment