From 5ee2e40e8c04dd179fd6c5dfcc5f5e15c6d01843 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Wed, 5 Feb 2014 11:11:38 +0100 Subject: [PATCH] udev: Add usb_xprofile script and rule --- udev/rules.d/99-keyboards.rules | 1 + udev/scripts/usb_xprofile.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 udev/rules.d/99-keyboards.rules create mode 100755 udev/scripts/usb_xprofile.sh diff --git a/udev/rules.d/99-keyboards.rules b/udev/rules.d/99-keyboards.rules new file mode 100644 index 0000000..cda6fc3 --- /dev/null +++ b/udev/rules.d/99-keyboards.rules @@ -0,0 +1 @@ +ACTION=="add", ENV{ID_INPUT_KEYBOARD}=="1", RUN+="/etc/udev/scripts/usb_xprofile.sh /dev/$name" diff --git a/udev/scripts/usb_xprofile.sh b/udev/scripts/usb_xprofile.sh new file mode 100755 index 0000000..fc599e5 --- /dev/null +++ b/udev/scripts/usb_xprofile.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. /usr/local/bin/getXenv.inc +getXconsole + +if [ -n "$XUSER" ]; then + USER_HOME=$(getent passwd $XUSER | cut -d: -f6) + FN="$USER_HOME/.usb_xprofile" + if [ -f "$FN" ]; then + ( + # Give X time to hear about the new keyboard + sleep 0.5 + su $XUSER -c "/bin/sh \"$FN\"" + ) & + fi +fi -- 2.39.5