I have a script that I wish to run whenever I plug/unplug a mouse or keyboard to my USB port.
There is already plenty of documentation on how to configure udev rules to run arbitrary scripts when a device is plugged or unplugged. But configuring those rules requires root permissions. And, although I do have root access on my machine, I'm looking for a solution that does not require sudo, root, or writing udev rules. (why? because it will be easier to run, maintain and distribute)
Most likely, the solution will use dbus, but I might be mistaken.
(By the way, I'm and advanced user and former Gentoo user, feel free to spit out technical details!)
Solutions that require root:
- Autorun a script after I plugged or unplugged a USB device
- http://granjow.net/udev-rules.html
- http://hg.dfrank.ru/linux/my-udev-notify (from this question/answer)
Seemingly outdated solutions that don't need root:
- This answer suggested cuttlefish, but the latest version is from 2012-08-24.
- This thread suggested halevt, but the latest version is from 2010-02-18.
- This question/answer points to this tutorial that has C++ source-code using the outdated and deprecated HAL.
xset
andxinput
commands to reconfigure my mice and touchpad whenever one of them gets connected.xinput
then and now work?