diff options
-rw-r--r-- | kvm-input.rules | 2 | ||||
-rwxr-xr-x | kvm-plugged-in.sh | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/kvm-input.rules b/kvm-input.rules index d1e6ec1..1fe73dd 100644 --- a/kvm-input.rules +++ b/kvm-input.rules @@ -17,4 +17,4 @@ # This invokes the script three times, so the trigger script must look for DEVTYPE="usb_device" because I couldn't find a way to do that here with an ATTRS # Dependencies: # /usr/local/bin/kvm-udev-trigger.sh -ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="04b3", ATTRS{idProduct}=="301b", RUN+="/usr/local/bin/kvm-udev-trigger.sh" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="1a40", ATTRS{idProduct}=="0101", RUN+="/usr/local/bin/kvm-udev-trigger.sh" diff --git a/kvm-plugged-in.sh b/kvm-plugged-in.sh index ee1958c..5357909 100755 --- a/kvm-plugged-in.sh +++ b/kvm-plugged-in.sh @@ -7,6 +7,7 @@ # Project: kvm-mapping # Purpose: for vm2, run my keyboard input script. # History: +# 2023-08-04 updated regex to include Logitech K, and a short sleep for it # Usage: # called by kvm-user-daemon.sh when the trigger file is made by the udev rule+script # Reference: @@ -17,7 +18,9 @@ # running in user context, with XAUTHORITY and DISPLAY and probably more env vars # Documentation: # The contents can be whatever you want. On vm2, I want to set my keyboard mappings. -for word in $( xinput list | sed -r -n -e 's/.*USB.*Keyboard.*id=([0-9]+).*keyboard.*/\1/p;' ) ; +sleep 2 +for word in $( xinput list | sed -r -n -e 's/.*(Keyboard|Logitech K[0-9]+).*id=([0-9]+).*keyboard.*/\2/p;' ) ; do setxkbmap -device ${word} -option grp:switch,grp:shifts_toggle -layout 'us,us(dvorak)' done +#notify-send --transient --icon 'keyboard' 'kvm reconnected' 'applied keymaps' |