You are not logged in.
Pages: 1
How do you catch certain events, both hardware and software?
For example I want to detect when my vga cable is unplugged or when mpd finishes playing a song.
I was playing around with handler.sh from acpid and I was hoping I could do the same for non-power related things.
Last edited by Hspasta (2012-02-06 03:17:07)
Offline
Does this do what you want?
udevadm monitor
Offline
I'm not sure how I would use that.
I should have been more clear in my original post. I want to run a script when I plug in my VGA automatically.
Offline
Ah, I see. Do a search in {forums,wiki} for how to run a script on udev events. Within the last month, I can recall a few threads/posts about such things as:
switching power saving measures on when the power cord is unplugged, and turning power saving off when the cord is plugged in
switching to HDMI audio when the HDMI cable is plugged in, and reverting to the laptop speakers when the HDMI cable is unplugged
I trust you'll be able to suitably modify such information to suit your specific requirements ;-)
Last edited by /dev/zero (2012-02-04 23:19:01)
Offline
You can use 'watch' with some script that will query e.g. 'xrandr' to see if something's connected to VGA.
Some apps may have built-in features e.g. turn off the computer after it finishes playing the last song from the list.
Offline
Thanks for all the input.
Offline
Pages: 1