aboutsummaryrefslogtreecommitdiff
path: root/kvm-plugged-in.sh
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-01-11 15:31:41 -0500
committerB. Stack <bgstack15@gmail.com>2023-01-11 15:31:41 -0500
commit5664ccbff51c98db034243070032044fd90637b9 (patch)
tree854e9440b76500771111d8b35d749b546bf7b0bd /kvm-plugged-in.sh
downloadkvm-mapping-5664ccbff51c98db034243070032044fd90637b9.tar.gz
kvm-mapping-5664ccbff51c98db034243070032044fd90637b9.tar.bz2
kvm-mapping-5664ccbff51c98db034243070032044fd90637b9.zip
initial commit
Diffstat (limited to 'kvm-plugged-in.sh')
-rwxr-xr-xkvm-plugged-in.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/kvm-plugged-in.sh b/kvm-plugged-in.sh
new file mode 100755
index 0000000..ee1958c
--- /dev/null
+++ b/kvm-plugged-in.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# File: /usr/local/bin/kvm-plugged-in.sh
+# Location: vm2
+# Author: bgstack15
+# Startdate: 2023-01-11-4 14:32
+# Title: Script that runs in user context when kvm is plugged in
+# Project: kvm-mapping
+# Purpose: for vm2, run my keyboard input script.
+# History:
+# Usage:
+# called by kvm-user-daemon.sh when the trigger file is made by the udev rule+script
+# Reference:
+# https://unix.stackexchange.com/questions/71348/why-doesnt-this-udev-rule-trigger-upon-removal-of-the-device
+# Improve:
+# Dependencies:
+# xinput and setxkbmap
+# 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;' ) ;
+do
+ setxkbmap -device ${word} -option grp:switch,grp:shifts_toggle -layout 'us,us(dvorak)'
+done
bgstack15