Power Management and Encryption

Bill Bogstad bogstad-e+AXbWqSrlAAvxtiuMwx3w at public.gmane.org
Tue May 18 22:01:19 EDT 2010


On Mon, May 17, 2010 at 7:51 PM, Bill Bogstad <bogstad-e+AXbWqSrlAAvxtiuMwx3w at public.gmane.org> wrote:
>...
>
> http://coderrr.wordpress.com/2008/04/20/getting-idle-time-in-unix/

I decided to flesh out the example in that blog post.  Attached is a
simple C program which takes two arguments as follows:

xidle minutes command

If the default X display becomes idle for more minutes then specified
the "command" will be executed.
Polling is every 10 seconds.  If "command" doesn't shutdown the
system, polling will continue and "command" will
be executed every 10 seconds until the X display goes non-idle.   To
shutdown, I would make "command" point to a shell script that calls
"sudo shutdown" and make sure that the user can run shutdown via sudo
with prompting.  (Haven't actually tried that.  I didn't want to
shutdown my machine.)

Enjoy,
Bill Bogstad





More information about the Discuss mailing list