-
-
Save taylor/4057678 to your computer and use it in GitHub Desktop.
Watch udev events and configure shit that should be automatically configured in the first place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
config_input() { | |
setxkbmap -option ctrl:nocaps | |
dev="TPPS/2 IBM TrackPoint" | |
xinput --set-prop "$dev" "Evdev Wheel Emulation" 1 | |
xinput --set-prop "$dev" "Evdev Wheel Emulation Button" 2 | |
xinput --set-int-prop "$dev" "Evdev Wheel Emulation Axes" 8 6 7 4 5 | |
} | |
config_display() { | |
xrandr --output LVDS1 --auto --output HDMI1 --auto --output VGA1 --auto | |
xset -dpms s off | |
} | |
config_input | |
config_display | |
unbuffer udevadm monitor \ | |
| unbuffer -p sed -e '/^UDEV.*(\(machinecheck.*\|hidraw\|drm\))$/!d' \ | |
-e 's/^.*(\(\w*\))$/\1/' \ | |
| while read -r line | |
do | |
udevadm settle | |
case "$line" in | |
"machinecheck"*) | |
config_input | |
config_display | |
;; | |
"hidraw"*) | |
config_input | |
;; | |
"drm"*) | |
config_display | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment