Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Run any ScreenSaver from the Login window' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Run any ScreenSaver from the Login window
Authored by: UncleJohn on Jan 22, '06 07:38:34AM
I found the check for logged in users to be unreliable under 10.4.4 with FUS enabled. But using the "open" command on the ScreenSaver app itself seems to solve a lot of problems.

1. If a user is logged in, it will show that user's screen saver

2. If login window is displayed, shows the default screen saver

I can skip the logged-in user step entirely, and the framework just seems to do the right thing. I haven't figured out how to pass command-line args via the "open" command, so the idle check is done separately. I also left in the check for screen saver already running, but this does not even seem necessary.

To change the default screen saver, edit /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/EngineDefaults.plist, changing moduleName to whichever one you want to use. The default is "Flurry" - I used "Pictures Folder".

If you use "Pictures Folder", you must give one to the root user. I made a symlink "Pictures" in /var/root to the folder I wanted to use. There is no need to enable root user login.

For some reason, I could never get this to work using launchd (black screen). But it works fine under cron.

I'm also not sure why it uses the default screen saver, even if root user is enabled has one specified in preferences. YMMV.

# First check to see if the screen saver is already running!
procList=`/bin/ps -auxwww | /usr/bin/grep -c "ScreenSaverEngine"`

if [ $procList -lt 2 ]; then
  # the screen saver is not already running, let's launch it,
  # but only if the system has been idle at least 5 minutes
  #get the system idle time in seconds
  idleTime=`/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/perl -ane 'if (/Idle/) {$idle=int((pop @F)/1000000000); print $idle,"\n"; last}'`
  if [ $idleTime -gt 300 ]; then
    open /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/

[ Reply to This | Parent | # ]