I’m currently running a Mac Pro with one monitor as my always-on server. My primary work machine is a 13” Air connected to a 27” Thunderbolt display. The Mac Pro display, the Air and the 27” are next to each other on the desktop, and I use teleport to fluidly pass between the monitors and control both machines with one keyboard and Magic Trackpad.

I wanted to sync the screen saver between the two machines, so I devised the following system. There may be easier ways to do this with fewer dependencies, but this solution is working great for me. An app called Synergy can replace both teleport and the need for this setup, so if it works well for you, just go that route. I ran into some issues with Synergy that I didn’t have with teleport, and I don’t need to run cross-platform, so I went this route instead.

  1. Set up a keyless ssh login to the remote machine
  2. Add a shell (apple)script for start/stop on the remote machine. Create a text file called ~/scripts/ss, where the tilde (~) is your home folder. It doesn’t have to be in ~/scripts, just keep track of wherever you choose to place it. Paste the following contents into it, changing “Hal 9000 [Full Screen] Advanced”1 to the name of whichever screen saver you want to run (as listed in the “Desktop and Screen Saver” pane of System Preferences):

    #!/usr/bin/osascript
    
    on run argv
        tell application "System Events"
            if argv is {}
                if name of processes contains "ScreenSaverEngine" then
                    set arg to "stop"
                else
                    set arg to "start"
                end
            else
                set arg to item 1 of argv
            end
    	
            if arg is "start" or arg is ""
                set ss to screen saver "Hal 9000 [Full Screen] Advanced"
                start ss
            else
                if name of processes contains "ScreenSaverEngine" then
                    do shell script "killall ScreenSaverEngine"
                end if
                tell application "Finder" to activate
            end if
        end tell
    end run

    This script will allow you to run “ss start” or “ss stop” from the command line (and over ssh) to start and stop the screen saver. If run without “start” or “stop,” it will toggle the state of the screen saver instead.

  3. Create an AppleScript on the primary machine for starting the remote screen saver (replace the path to the script with your own if not in ~/scripts, and the “macpro.local” with your own machine’s network name):

    do shell script "ssh macpro.local \"~/scripts/ss start\""

    and one for stopping

    do shell script "ssh macpro.local \"~/scripts/ss stop\""

    If triggering these from EventScripts as recommended below, you’ll eventually need to save them to the EventScripts script folder. Save them to your Desktop for now.

  4. Install EventScripts ($2.99 on the App Store). (There’s an older screen saver called “ScriptSaver” that should do this, but I couldn’t get it working on Mountain Lion.)
  5. From EventScript preferences, in the EventScripts pane, click the “Open Folder” button to reveal the scripts folder. Move the start and stop AppleScripts from above to this folder.
  6. In EventScripts, click “Add Script” and select the “start” script. Choose “Screensaver started” as the trigger event. Add a second one with the trigger “Screensaver will stop” for the “stop” script.

Now, when your screen saver starts on your main machine, other machines will also go into screensaver mode. When you move the mouse or press a key on the main machine, the other screens will wake up.

  1. I really like Hal Project screen saver, by the way. You could modify the script to take a second argument and make the screen saver selection more dynamic, or possibly find a way to read the screen saver selection on the primary machine and pass it to the remote machine to automate the process. I didn’t dig into that.