bin: update keyboard layout appropriately

This commit is contained in:
xerus2000 2021-03-04 22:19:34 +01:00
parent 87029abc06
commit d45f867215
1 changed files with 8 additions and 7 deletions

View File

@ -1,13 +1,14 @@
#!/bin/sh #!/bin/sh
( (
test "$ACTION" && case $ACTION in case $ACTION in
add|change) id=1;; add) id=1;;
remove) id=0;; remove) id=0;;
esac || id=$(test -c /dev/ttyACM0 && echo 1 || echo 0) esac || id=$(test -c /dev/ttyACM0 && echo 1 || echo 0)
echo "Keyboard layout update to $id at $(date)" >>/tmp/scripts.log echo "Keyboard layout update to $id($ACTION) at $(date)" >>/tmp/scripts.log
#XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 setxkbmap "$id" #nodeadkeys export XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0
XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 $(dirname $(dirname $0))/xkblayout-state set $id # setxkbmap "$id" #nodeadkeys
$(dirname $(dirname $0))/xkblayout-state set $id
# Swap semicolon and colon - https://unix.stackexchange.com/questions/615799/swap-semicolon-colon-to-p-unexpected-cause-semicolon-colon-affected-by-cpas-lock # Swap semicolon and colon - https://unix.stackexchange.com/questions/615799/swap-semicolon-colon-to-p-unexpected-cause-semicolon-colon-affected-by-cpas-lock
# test "$id" = "eu" && XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' # test "$id" = "eu" && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon'
test "$id" = "0" && XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' test "$id" = "1" && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' || setxkbmap de nodeadkeys
) >>/tmp/scripts.log 2>&1 ) >>/tmp/scripts.log 2>&1