Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Daniel Feenberg wrote: > Further search on google suggests the only way to accomplish this is to > write a cron job that periodically consults the "w" command for idle > times. While that may be the most general solution, if you're talking about specifically a system running GNOME (or possibly other freedesktop.org compliant desktops), then a cleaner solution is polling the previously mentioned API, or better yet, I believe you can create a DBUS client that will receive notification of screensaver events. Take a look at: http://www.newegg.com/Product/Product.aspx?Item=N82E16880121002 A 2006-era message describing the GNOME Power Manager DBUS API and GNOME Screensaver DBUS API, which includes methods to query the current state, and issue a shutdown. (Google also references: http://live.gnome.org/GnomePowerManager/DbusInterface but the links there don't seem to lead to the API documentation.) Both APIs are described as being unstable: http://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions#I.27m_developing_an_application_that_has_a_fullscreen_mode.__Is_there_a_way_that_I_can_disable_the_screensaver.3F "Please be warned that the gnome-screensaver DBus API is currently unstable and may change in the future." That links to the screensaver DBUS API documentation: http://people.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html which describes, for example, the SessionIdleChanged signal. Using the GNOME Power Manager DBUS API might cover more situations than using the screensaver API. For example, if you assume your user isn't necessarily knowledgeable or cooperative with your security policies, and you want to prevent them from being able to manually suspend or hibernate the machine. What I'm not seeing in the GNOME Power Manager DBUS API is a mechanism by which a program can register to receive notification of events like suspend and hibernate, and then reply to that signal in a way that halts the operation. There is an inhibit() method to prevent suspend/hibernate, but then it isn't clear that the DpmsModeChanged signal would ever fire on idle or the user's attempt to suspend/hibernate. And if you don't inhibit(), it's hard to say whether your code would receive the DpmsModeChanged signal and have time to act on it before the suspend/hibernate commenced. (It also seems that DpmsModeChanged documents a suspend state, but not a hibernate state. Could be a documentation oversight, or a reflection that DPMS is intended for monitors, where the distinction is irrelevant.) -Tom -- Tom Metro Venture Logic, Newton, MA, USA "Enterprise solutions through open source." Professional Profile: http://tmetro.venturelogic.com/
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |