2020-10-13 09:41:47 +00:00
|
|
|
#!/bin/sh
|
2021-03-04 11:28:26 +00:00
|
|
|
(
|
2021-03-04 21:19:34 +00:00
|
|
|
case $ACTION in
|
|
|
|
add) id=1;;
|
2020-10-13 09:41:47 +00:00
|
|
|
remove) id=0;;
|
|
|
|
esac || id=$(test -c /dev/ttyACM0 && echo 1 || echo 0)
|
2021-03-04 21:19:34 +00:00
|
|
|
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
|
2021-03-04 11:28:26 +00:00
|
|
|
# Swap semicolon and colon - https://unix.stackexchange.com/questions/615799/swap-semicolon-colon-to-p-unexpected-cause-semicolon-colon-affected-by-cpas-lock
|
2021-03-04 21:19:34 +00:00
|
|
|
# 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
|
2021-03-04 11:28:26 +00:00
|
|
|
) >>/tmp/scripts.log 2>&1
|