1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

Add keyboard toggle script

This commit is contained in:
Joe Groocock 2016-04-17 15:32:03 +01:00
parent 3f7c08a0fd
commit d08637f5b7
3 changed files with 19 additions and 1 deletions

10
.config/i3/blocks/keyboard Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
[[ $BLOCK_BUTTON -eq 1 ]] && `$DOTFILES/scripts/togglekeyboard`
layout=$(setxkbmap -query | grep 'layout:' | awk '{print $2}')
variant=$(setxkbmap -query | grep 'variant:' | awk '{print $2}')
short=`([ "$variant" ] && echo $variant || echo $layout) | cut -c1-2`
echo -e "$short\n$short" | awk '{print toupper($0)}'

View File

@ -92,7 +92,11 @@ interval=5
#label=
#interval=5
#[separator]
[keyboard]
label=
interval=30
[separator]
[clock]
interval=5

4
scripts/togglekeyboard Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
variant=$(setxkbmap -query | grep 'variant:' | awk '{print $2}')
[ "$variant" == "dvorak" ] && setxkbmap gb || setxkbmap gb dvorak