summaryrefslogtreecommitdiff
path: root/users/ericgebhart/switch-kbd
diff options
context:
space:
mode:
authorEric Gebhart <e.a.gebhart@gmail.com>2018-06-08 19:06:25 +0200
committerDrashna Jaelre <drashna@live.com>2018-06-08 10:06:25 -0700
commit984621835d929b79a22ef33c0a4e602adb1ecc5b (patch)
tree11637c54105b229f3127b019ff0cc962926fb770 /users/ericgebhart/switch-kbd
parent03c9deb7456d84a8d8cc31496ae2736305bbafd3 (diff)
downloadqmk_firmware-984621835d929b79a22ef33c0a4e602adb1ecc5b.tar.gz
qmk_firmware-984621835d929b79a22ef33c0a4e602adb1ecc5b.zip
Keyboard that works on Qwerty or Bepo OS keyboards. (#3149)
* New layout. * new dvorak bepo layout. * first commit of new ergodox_ez dvorak keyboard for qwerty and bepo.
Diffstat (limited to 'users/ericgebhart/switch-kbd')
-rwxr-xr-xusers/ericgebhart/switch-kbd74
1 files changed, 74 insertions, 0 deletions
diff --git a/users/ericgebhart/switch-kbd b/users/ericgebhart/switch-kbd
new file mode 100755
index 0000000000..4401967a0f
--- /dev/null
+++ b/users/ericgebhart/switch-kbd
@@ -0,0 +1,74 @@
+#!/usr/bin/env zsh
+
+# Switch the keyboard to en-us by default, bepo, or en-dvorak.
+
+help(){
+ print 'switch-kbd - helper for setxkbmap'
+ print ' '
+ print 'Change the keyboard to en-us, fr-bepo, or en-dvorak.'
+ print 'Uses setxkbmap, so the change only affects the current'
+ print 'session. This mainly to avoid using a toggle key.'
+ print ' '
+ print ' -b Bepo'
+ print ' -d Dvorak'
+ print ' -n do not execute'
+ print ' -h help text.'
+ print ' '
+ print ' The default is to set the keyboard to en-us.'
+ exit
+}
+
+layout="-layout us"
+variant=""
+let "execute = 1"
+let "verose = 0"
+
+# $opt will hold the current option
+local opt
+while getopts bdnvh opt; do
+ # loop continues till options finished
+ # see which pattern $opt matches...
+ case $opt in
+ (b)
+ layout="-layout fr"
+ variant="-variant bepo"
+ ;;
+
+ (d)
+ layout="-layout en"
+ variant="-variant dvorak"
+ ;;
+ (n)
+ let "execute = 0"
+ ;;
+ (v)
+ let "verbose = 1"
+ ;;
+ (h)
+ help
+ ;;
+ # matches a question mark
+ # (and nothing else, see text)
+ (\?)
+ print "Bad option:" $*
+ print " "
+ help
+ return 1
+ ;;
+ esac
+done
+(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))
+##print Remaining arguments are: $*
+
+mycommand='setxkbmap '${layout}' '${variant}
+
+if [[ ( $verbose -ne 0 ) ]]; then;
+ print "setxkbmap Command:" $mycommand
+fi
+
+if [[ ( $execute -ne 0 ) ]]
+then;
+ eval $mycommand
+else;
+ print "did not execute"
+fi