dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 4aebe252cbbb69e0860c2ab7153b638d28a4b5e5
parent 29af6f30aef3d4f31295c700cf63cd6f46812e69
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Tue, 10 Sep 2013 13:54:49 +0200

added script to switch keyboard layout between two values

Diffstat:
Abin/keyboard-layout-switch.sh | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/bin/keyboard-layout-switch.sh b/bin/keyboard-layout-switch.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# the language is written to ./.kbd-layout +LAYOUTFILE="./.kbd-layout" + +# define two languages +LANG1="us" +LANG2="dk" + +# write the file if it doesn't exist +if [ ! -f $LAYOUTFILE ]; then + echo "us" > $LAYOUTFILE + setxkbmap $LANG1 + exit +fi + +# read the language file, and switch to the other language +CURRLANG="`cat $LAYOUTFILE`" + +if [ "$CURRLANG" == "$LANG1" ]; then + echo $LANG2 > $LAYOUTFILE + setxkbmap $LANG2 +else + echo $LANG1 > $LAYOUTFILE + setxkbmap $LANG1 +fi