[mythtv-users] Slightly OT: Detect keyboard/mouse activity

David Brodbeck gull at gull.us
Mon Dec 3 20:27:06 UTC 2007


I'm writing a script to control my slave backend, with the aim of  
saving power.  Specifically, I'm powering it up when there's an  
impending conflict, and shutting it down if it's not scheduled to  
record anything for a while.  One sticking point is that this is also  
a desktop machine, so I don't want to shut it down if I'm actively  
using it.  I need a way to detect keyboard and mouse activity.

My first thought was to set up xscreensaver, and just check to see if  
the screen saver had activated.  This works except I can't get  
xscreensaver to reliably trigger.  It seems when the system does auto- 
login and KDE launches it from the Autostart directory, it doesn't  
work, but if I run it manually from a terminal it will.  I'm at a  
loss to explain this; maybe it's because I have a USB keyboard?   
kscreensaver exhibits the same behavior.

If anyone has any other suggestions for detecting user activity, I'd  
appreciate it.  I could just switch to manual logins and have the  
script check to see if I'm logged in, but I really like the  
convenience of KDE's auto-login, so I'd prefer not to go that route.



More information about the mythtv-users mailing list