Screen saver's status ...

Hi,

I need to know if the screen saver is suspended (with the »hot corners»). Not if screen saver is running if it exists or not», but if it is «suspended». Is there a way to get the screen saver’s status ? The only way I found is to check the mouse pointer’s location. There must be a simpler way to get this answer …

Robert

Robert

You can check the idle time for the screen saver with this command…

set ssIdleTime to (do shell script "/usr/bin/defaults -currentHost read com.apple.screensaver idleTime") as number

I have my screen saver completely disabled and my idle time is 0. My guess would be that when the screen saver is suspended the value of the command would be 0, although I’m not positive because as you can see I don’t use the screen saver.

Note that you can set the idle time too with the following. Setting it to 0 will suspend it.

set ssIdleTime to 0
do shell script "/usr/bin/defaults -currentHost write com.apple.screensaver idleTime " & ssIdleTime

Hi Regulus,

Your first shellscript retrieves the screen saver idle time. It gives the time that I have setup in the system prefs for the screen saver to go on. Your second script modifies by script the idle delay.

This does not help me to know the status of the screen saver.

Thanks for trying.

Robert

Hi Robert, isn’t that what “suspended” means? The screen saver is suspended when the idle time is 0. At least that’s my understanding. If not then tell me what it is.

My guess was that when you move the mouse to the corner of your screen (to the hot corner) that it sets the idle time to 0 and then resets the idle time to whatever it was when you move your mouse away. I didn’t test it but that was my guess. Did you test it? If my guess is correct then just test for 0 instead of the mouse pointer location.

Good evening Regulus,

The idletime is set to 0 when you manually set it to «never» in the screen saver pane of the System preferences. If you change manually the screen saver idletime to «10», your shellscript will read «10».

It does not confirm, though, the «suspended» status that I am looking for. If you suspend your screen saver with one of the hot corners and if you read the result with your shellscript it will return the idletime that has been preset in the screen saver pane not «0». There is probably another pref file that holds the suspended status of a hot corner.

I have an idle script that monitors my computer’s activity. When the computer is idle for a certain amount of time, the script permutates my user to the login window. After, if there is no specified activity executing (backup, printing, etc …), the script then puts my computer to sleep until it is awaken by Power Manager’s schedule. Sometimes I need to manually prevent the permutation, so I use the hot corner that suspend my screen saver as a criteria to prevent the permutation and the sleep process.

We are getting close, but we are not there yet … ;););););):wink:

Thanks for helping.

Robert Lespérance

OK, so you did test it and the idle time isn’t set to 0 when using the hot corner.

This is why I included the second script for setting the idle time. My thought was that you could use that script to suspend the screen saver instead of the hot corner. If you do this then you can test for 0 to see the status of the screen saver.

To use the setting-idle-time script, make it into a toggle-type script. In other words, use it to toggle the screen saver to on or off. For example, run the script and find the idle time. If the idle time is 0 then set the idle time to whatever you normally use (thus the screen saver is on). If the idle time is not 0 then set it to zero (thus the screen saver is off or suspended).

If it’s possible to use that toggle script instead of a hot corner it may make things easier for you. Just run it from the script menu and it should be just as easy as a hot corner.

Anyway, that’s the best I can think of without knowing another way to detect the hot corner.

That is a very good idea …

Thanks ! :D:D:D

Regulus,

Your idea is even better … I could suspend the permutation with a «Butler» or «Fkey» shortcut. It would trigger the «ScreenSaver idletime reset» on the fly and I would still be able to use my mouse until I reset back the idletime.

Thanks again for your help ! Regards.

Robert

Exactly my thought… much better than a hot corner and just as easy to activate/deactivate. Glad to help. Good luck!

Hi Regulus,

Yesterday we worked on the screen saver. Do you have any idea what file to shellscript in order to suspend the screen activity in the system preferences’s energy saver pane ?

Thanks again.

Robert

A quick google search turned this up. It looks exactly like what you need…
http://www.macosxhints.com/article.php?story=20080518162911638

Help from people like you and the www are priceless friends. Cafeine just does it ! Thank you.