Caffeinate Screen Sharing Macro (v9.2)

Caffeinate Screen Sharing Macro (v9.2)

This is a fairly simple macro I wish I had thought of a long time ago:

Problem

Sometimes I run 'Screen Sharing' to monitor another Mac, but since I'm not always "active" (just watching), my Mac tries to go to sleep on me (especially the display likes to dim and then turn off).

Possible Solutions

  1. You could run Amphetamine and tell it to keep the Mac awake when the app runs (see Amphetamine » Preferences » Triggers). But that requires that you have the app installed and running.

  2. You could use the built-in caffeinate tool. But that requires finding the "Process ID" (or "PID") of the Screen Sharing.app and entering the command in Terminal.

Door Number Two

This macro uses the second option, and it uses Keyboard Maestro to run caffeinate automatically whenever Screen Sharing.app runs, and it uses pgrep to automatically get the PID so you don't have to do anything.

It even puts up a notification when it runs to remind you that your Mac will not sleep while Screen Sharing.app is running.

You can duplicate this macro for any application, just change the Screen Sharing after pgrep -x to be the name of the app that you want to use, and change the Keyboard Maestro trigger accordingly.

Download: Caffeinate Screen Sharing.kmmacros (24 KB)

4 Likes