Cocktails and Coffee Logo |||

Using Your Apple Watch To Trigger Your Screensaver

I sometimes work in a corporate-y office. I also tend to walk around a lot, and leaving your computer unlocked can be dangerous. Naturally, I have a workflow that will allow me to lock my computer from afar when I’ve wandered off.

There are a few nerdy tools needed, but you should have these anyway.

  • Workflow, an awesome iOS automation app
  • Hazel, a great automated organizer app for your Mac.
  • Dropbox.
  • and of course, an iPhone, Apple Watch and a Mac.

First thing you will want to do is put a text file in an accessible folder on your Dropbox. I use Launch Center Pro for a lot of other automation, so I put the file in Dropbox/Apps/LCP because I’m already monitoring that folder with Hazel. More on that in a bit. Name the file something creative, like sleep.txt.

Now go to your System Preferences and open Hazel. In the left pane, click the +” button and add the folder your text file is in (mine is in /Apps/LCP, but yours can be anywhere on your Dropbox.) Then, in the right pane, click the other +” button to add a new rule.

  • Name it something recognizable
  • If ALL of the following are met:
    • Name IS sleep.txt
    • Date Least Modified IS IN THE LAST 1 minute
  • Do the following:
    • Run AppleScript - embedded script

Then, paste in the following simple AppleScript, which starts the screensaver.

    tell application "ScreenSaverEngine"
        end tell

Hazel PrefsHazel Prefs

Great. What the hell just happened? You just told Hazel that if the sleep.txt file has changed in the last minute, then run this script that starts the screensaver. You can test this by just opening sleep.txt and typing a letter or two then saving. Once the save is complete, the Last Modified timecode changes to now, which is obviously in the last minute. So, the screensaver starts up. Pretty sweet. Now, to activate this from the Watch.

On your iPhone, fire up Workflow and create a new one. Make sure it’s set up as an Apple Watch workflow. Choose an appropriate name and icon. Then build a simple two-step Workflow:

  • Text (can be anything, I use Go to sleep”)
  • Append to Dropbox File
    • Mode: Append
    • File Path: /Apps/LCP/sleep.txt
    • Make New Line (optional, but I leave it on)

Workflow ScreenshotWorkflow Screenshot

Now, when you tap this Workflow from your Watch, a line of text is appended to the text file, which changes the modify date, which launches a screensaver.

If you don’t want to build it yourself, you can download my Workflow here. As an added bonus, you can also add this Workflow to your iPhone’s home screen and run it from there, just select Normal” in the workflow setup. The only limitation to this way of doing things is you can only trigger the screensaver once a minute.

Have fun with this. If you’re using it, let me know on the Twitter!

🗓️ May 27, 2015 🏷️ Apple Watch 🏷️ Mac 🏷️ Automation 🏷️ Launch Center Pro 🏷️ iOS 🏷️ Dropbox 🏷️ Hazel
⇦ Previous New Tricks
Next ⇨ Santa Monica
CC BY-NC-SA 4.0 © 2007-2023 Jimmy Little Support me on Ko-fi