Skip to content

Instantly share code, notes, and snippets.

@hudvin
Created March 2, 2018 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hudvin/28719a05b273f82edf0cb3d996798d4f to your computer and use it in GitHub Desktop.
Save hudvin/28719a05b273f82edf0cb3d996798d4f to your computer and use it in GitHub Desktop.
keyboard switcher EN<>RU and DE
#!/bin/bash
mode=$1
echo $mode
if [ "$mode" == "de" ]; then
echo "switching to DE layout"
xkb-switch -s de
elif [ "$mode" == "us_ru" ]; then
current_layout=$(xkb-switch)
echo $current_layout
if [ "$current_layout" == "de" ]; then
xkb-switch -s us
fi
if [ "$current_layout" == "us" ]; then
xkb-switch -s ru
fi
if [ "$current_layout" == "ru" ]; then
xkb-switch -s us
fi
else
echo "incorrect params"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment