From e443ca810eede882b0d6ca5e1e9ea0949ec522c2 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Wed, 6 Jul 2022 23:14:49 +0200 Subject: [PATCH] bin/update-keyboard-layout: fix model01 detection --- .local/bin/scripts/update-keyboard-layout | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.local/bin/scripts/update-keyboard-layout b/.local/bin/scripts/update-keyboard-layout index 555b807..64cf804 100755 --- a/.local/bin/scripts/update-keyboard-layout +++ b/.local/bin/scripts/update-keyboard-layout @@ -1,20 +1,21 @@ -#!/bin/sh +#!/bin/sh -e umask 0 { case $ACTION in (add) id=1;; (remove) id=0;; - (*) id=$(! test -c /dev/ttyACM0; echo $?);; + (*) id=$(! test -c /dev/ttyACM0 -o -c /dev/model01; echo $?);; esac -echo "Keyboard layout update to $id($ACTION) at $(date)" +echo "Keyboard layout update to $id($ACTION) at $(/usr/bin/date)" export XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0 xkbstate="$(dirname $(dirname $0))/xkblayout-state" test "$($xkbstate print %C)" -gt 1 && $xkbstate 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" && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' if test "$id" = "1" -then setxkbmap eu && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' +then setxkbmap eu -option "" && xmodmap -e 'keysym semicolon = colon semicolon colon semicolon' else setxkbmap de nodeadkeys caps:swapescape fi } 2>&1 | tee -a /tmp/scripts.log