commit 98ef69c407f403eb05f3bba79e57bbb76db26b77 parent b318f2a7228b0695fdd9a59cde66aa058ee9290f Author: Jake Bauer <jbauer@paritybit.ca> Date: Tue, 29 Dec 2020 18:54:58 -0500 Change keyboard layout change script Diffstat:
M | .local/bin/change-kb-layout.sh | | | 14 | +++++++++----- |
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/.local/bin/change-kb-layout.sh b/.local/bin/change-kb-layout.sh @@ -1,8 +1,12 @@ #!/bin/sh -# First argument is the layout to switch to -if [ "$1" = "ru" ]; then - setxkbmap -layout "$1" -variant phonetic -else - setxkbmap -layout "$1" +currentlayout=$(cat /tmp/current_layout) + +# Cycle through keyboard layouts +if [ "$currentlayout" = "us" ]; then + setxkbmap -layout ru -variant phonetic + echo "ru" > /tmp/current_layout +elif [ "$currentlayout" = "ru" ]; then + setxkbmap -layout us + echo "us" > /tmp/current_layout fi