From d45f8672150bab78978f5ab4490193db1fe130fd Mon Sep 17 00:00:00 2001 From: xerus2000 <27jf@pm.me> Date: Thu, 4 Mar 2021 22:19:34 +0100 Subject: [PATCH] bin: update keyboard layout appropriately --- .local/bin/scripts/update-keyboard-layout | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.local/bin/scripts/update-keyboard-layout b/.local/bin/scripts/update-keyboard-layout index 3a1d9d4..c82206f 100755 --- a/.local/bin/scripts/update-keyboard-layout +++ b/.local/bin/scripts/update-keyboard-layout @@ -1,13 +1,14 @@ #!/bin/sh ( -test "$ACTION" && case $ACTION in - add|change) id=1;; +case $ACTION in + add) id=1;; remove) id=0;; esac || id=$(test -c /dev/ttyACM0 && echo 1 || echo 0) -echo "Keyboard layout update to $id at $(date)" >>/tmp/scripts.log -#XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 setxkbmap "$id" #nodeadkeys -XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 $(dirname $(dirname $0))/xkblayout-state set $id +echo "Keyboard layout update to $id($ACTION) at $(date)" >>/tmp/scripts.log +export XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 +# 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 -# test "$id" = "eu" && XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 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" = "eu" && 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