A Better Inactivity Triggered Sleep

The most common use of Power Manager is to improve the automatic sleep capabilities of your Mac. Putting your Mac to sleep, or better still shutting down, after periods of inactivity will save you a noticeable amount of energy.

macOS’s sleep after idle time is difficult to predict. The exact factors that macOS uses to determine when the Mac is idle are not widely known and differ between major editions of macOS.

Power Manager offers an alternative. We provide an inactivity triggered sleep. Inactivity is measured differently from idle time; inactivity is a simpler measurement determined solely by user activity.

An inactive computer is one where no user activity is taking place. User activity is the act of you, or someone else, actually interacting with the computer i.e. moving the mouse, typing on the keyboard, or using an input device such as a barcode scanner.

Let’s create an inactivity triggered sleep event.

Launch Power Manager from within the Applications folder.

Power Manager with an empty schedule

Create a new event using the menu item: File > New Event…. Alternatively, click on the Add… button.

The Schedule Assistant will and provide a selection of templates and step-by-step guides for creating common events and tasks.

Select the Power Events > Power off after inactivity item. Note the description changes as you change the selected template. Once selected, the template mentions sleeping or powering off if the user is inactive. This template is ideal for creating a better inactivity event.

Power Manager’s Schedule Assistant

Click on the Continue button to begin setting up your new energy saving event.

In this step, the Schedule Assistant presents options about the what and when of your new event. The left hand column shows this task’s steps. The Schedule Assistant groups options affecting your task into steps. We will step through each in turn.

Power off after inactivity: What and When

Each steps’ defaults are generally the settings you should start with. This template suggests sleeping after 15 minutes of inactivity. That seems reasonable for most situations.

You can alter the period of inactivity to any value between one minute and 24 hours; you can even specify the period to an accuracy of seconds.

The period of inactivity field acts differently from most text fields. When the contents are selected, they appear in numeric form: 0:15:00. This value represents hours:minutes:seconds. When the content is deselected or validated, the numeric values are replaced by a more readable equivalent.

At this point your inactivity event has all the information it needs to begin being useful to you. However, a few more steps remain. These next steps deal with exceptions and edge case situations that you might need.

Smarter Constraints

An inactive computer may still be doing useful work, such as recording digital television, providing a service, or rendering content.

If your computer is busy doing useful work but left unused, then an inactivity triggered event will occur and your Mac will enter sleep. This may not be what you want. For these situations, Power Manager provides per event criteria.

Powerful Criteria

Criteria allow you to create events that are triggered using simple and predictable triggers such as inactivity, while allowing for exceptions and special cases.

When an event is triggered, its criteria are evaluated to see if the event’s actions should be performed. If the criteria are not met, then the event’s actions will not be performed.

For our inactivity task, the Schedule Assistant has two steps of constraints. The constraints are grouped by kind: time based constraints and interactive constraints.

Time Based Constraints

Time based constraints allow you limit when the inactivity triggered event can put your computer to sleep.

Power off after inactivity: Time Constraints

Let’s look at The time is between: constraint. If the checkbox is enabled (checked), the constraint will be evaluated and enforced. If the checkbox is not checked (unchecked), the constraint has no effect and the inactivity triggered sleep may happen at any time of the day.

The time range offers two possibilities. You can enter a simple time range such as 9:00 am - 5:00 pm. This range will restrict the inactivity triggered sleep to times between these two times.

The other possibility is a touch more subtle; you can enter the later time first, such as 5:00 pm - 9:00 am. This range inverts the restricted times. The inactivity trigger sleep can now only occur between 5:00 pm through, passing midnight, until 9:00 am the next day.

Time based constraints are positive conditions. That means you should read the constraints in positive terms, such as if the time is between 9:00 am and 5:00 pm, the event can be performed, or if the day of the week is Wednesday or Sunday, the event can be performed.

The event will not be performed unless all the enabled time based constraints are met.

For now leave the time constraints disabled (unchecked); you can always come back later and edit the event’s constraints.

Click the Continue button to move to the Interactive Constraints step.

Interactive Constraints

Interactive constraints allow you to limit your inactivity triggered event based on other activities running on your Mac.

Power off after inactivity: Interactive Constraints

Neither macOS’s Energy Saver or Power Manager can accurately know what you consider critical and uninterruptible, versus applications that you do not mind interrupting. These decisions are individual and differ between users.

To help Power Manager make smarter decisions about when to put your Mac to sleep, you need to list the situations that you want to stop your Mac entering inactivity triggered sleep.

Interactive constraints are negative conditions. That means you should read the conditions in negative terms, such as if the display is captured in full screen mode, do not sleep, or if QuickTime Player or Final Cut Pro is running, do not sleep.

The Schedule Assistant offers three interactive constraints. The event can only be performed if none of the interactive constraints are met. Just one interactive constraint being true, is enough to stop the inactivity triggered sleep.

For now leave the interactive constraints disabled (unchecked); you can always come back later and edit the event’s constraints.

Click the Continue button to move to the Why step.

Every Power Manager event has a name and an optional notes section.

Power off after inactivity: Why

The Event Name is used throughout Power Manager to refer to the event. When naming your event, try to be descriptive and use language that describes the purpose of the event. An event named Sleep for lunch, is better than Sleep at 1pm; the event’s intended purpose is clearer.

An event’s name does not need to be unique. Power Manager will happily work with multiple events using the same name. For the sake of avoiding confusion, prefer using unique event names were possible.

The Notes are for your personal use. These notes do not affect the performance or behaviour of the event. Use the notes as best suits your needs. If you are providing a schedule or events for others, consider writing what the event is intended to do and include your contact details in case of problems.

Enter a suitable event name, such as Sleep after inactivity.

Click the Continue button to move to the final Confirm step.

In the Confirm step, the Schedule Assistant shows you a list of events that will be created to perform your choosen task. In the case of our inactivity triggered event, only one event is needed.

Power off after inactivity: Confirm

The proposed event is displayed along with a summary describing the basic behaviour of the event. The description is useful for gleaning the purpose of the event, but should not be considered complete; events can be more complex than can be represented in a single sentence.

Click the Add button to create the event and add it to your schedule.

Congratulations, you now have an inactivity triggered sleep event. You have just created a more predictable alternative to macOS’s idle time sleep.

Power Manager: Sleep after inactivity event

Be sure to test your new event by leaving your Mac inactive for at least 15 minutes. That means no moving the mouse or typing on the keyboard. Any time you do interact with your Mac, the inactivity timer is reset back to zero.

Editing Your New Event

As you test and become more comfortable with your new inactivity triggered sleep event, you may find you want to enable some of the time based and interactive constraints.

You can edit your event by double-clicking on the event in the Power Manager application. The Schedule Assistant will appear pre-filled with your event’s options and settings.

To change the event’s behaviour, step through the Schedule Assistant’s steps and select Save at the end of the steps. Only when Save is selected are any changes applied.

Combining Multiple Inactivity Events

You can create multiple inactivity triggered sleep events with differing constraints and have them work in unison.

Let’s walk through a common home office situation where combining multiple inactivity triggered sleep events can save even more energy.

Supporting multiple inactivity events is a great example of how Power Manager improves your computer’s capabilities. Where macOS’s built-in capabilities are limited to a single idle time triggered event, Power Manager is unconstrained.

Power Manager can schedule as many events as you need.

Most Macs in home offices are used for two separate tasks. During the working week the Mac is used solely for work. During this time the Mac is used to a fairly predictable schedule which does not change day to day. During the weekends the same Mac is used casually for browsing and entertainment.

This periodic change in use, demands a slightly more sophisticated energy saving schedule.

To deal with this situation, we will create two inactivity triggered sleep events. Both events will use a day of the week constraint to restrict when they are able to put the home office Mac to sleep.

Weekday Inactivity Event

Let’s create an inactivity triggered sleep event to handle the working week.

Launch Power Manager.

Power Manager with an empty schedule

Click on the Add button to open the Schedule Assistant, or use the menu item: File > New Event….

Select the Power Events > Power off after inactivity template. This is a capable template and one you are likely to use frequently.

Power Manager’s Schedule Assistant

During the working week, the Mac is in near constant use and needs to be available immediately. We are going to increase the default inactivity period to 20 minutes. This means that our event will only put the Mac to sleep, if it has been inactive for 20 minutes or more.

To adjust the inactivity duration, click on the duration field.

Power off after inactivity: What and When

To enter the duration of 20 minutes, type 0:20:00 and press the tab key on the keyboard to validate the field.

Power off after 20 minutes of inactivity

Entering Durations

The duration field interprets the last numeric value, 00, as seconds. The former value is minutes. If you had typed three numeric values, the first value would have been interpreted as hours.

If you enter 20 and press the tab key on the keyboard, the duration field will interpret the value as 20 seconds. 20 seconds is too small a duration for this task, so the lowest allowed duration of 1 minute will be used instead.

If you enter 20 30 and press the tab key on the keyboard, the duration field will interpret the value as 20 minutes and 30 seconds.

Once the duration field is set to 20 minutes, click the Continue button to move onto the Time Constraints step.

Power off after inactivity: Time Constraints

For this event, sleeping after 20 minutes of inactivity must only occur on weekdays. To include this constraint, enable (check) The day of the week is: checkbox. Once enabled, the individual day of the week checkboxes will become active.

By default, all the days of the week are enabled (checked). As we only want the sleep action to occur on weekdays, we need to disable (uncheck) Saturday and Sunday. Click once on Saturday and Sunday to disable these days.

Power off after inactivity only on weekdays

With the day of the week constraint enabled, and Saturday and Sunday excluded, our event is almost ready.

As this point the event has an inactivity trigger with a duration of 20 minutes, and a day of the week constraint limiting the sleep action to weekdays only.

Click the Continue button to move to the Interactive Constraints step.

We can skip over the Interactive Constraints step, as there are no interactive constraints needed for this weekday event.

Power off after inactivity: Interactive Constraints

Click the Continue button to move to the Why step.

In the Why step, enter the event name Work: inactivity sleep. The event name and notes do not affect the event’s behaviour; you can enter any name you like, in any language your Mac supports.

Name the weekday inactivity triggered event

Click the Continue button to move to the Confirm step.

The Confirm step shows the weekday event ready for adding to your schedule. Note the description makes no direct mention of the day of week constraint; this is correct. Rather than trying to fit every last piece of information into the summary line, Power Manager focuses on displaying the most important details.

Confirm the weekday inactivity triggered event

Click the Add button to create the event and add it to your schedule.

We now have a single inactivity triggered sleep event that works during the working week. This event has no affect on Saturday or Sunday thanks to its day of the week constraint.

An inactivity triggered sleep event

Next we will create a second inactivity trigger sleep event to handle only Saturday and Sunday, when the Mac is being used for non-work related activities.

Weekend Inactivity Event

Let’s create an inactivity triggered sleep event to handle the weekend: Saturday and Sunday.

Click on the Add button to open the Schedule Assistant.

Select the Power Events > Power off after inactivity template. This is the same template as we used for the weekday event.

Power Manager’s Schedule Assistant

During the weekend, the Mac is infrequently used. We want to save as much power as possible, and so will reduce the required inactivity duration to five minutes.

Power off after 5 minutes of inactivity

To adjust the inactivity duration, click on the After how long inactive? field.

To enter the duration of five minutes, type 5 0 and press the tab key on the keyboard to validate the field.

For this weekend only event, we need to use the day of week constraint. To include this constraint, enable (check) The day of the week is: checkbox. Once enabled, the individual day of the week checkboxes will become active.

By default, all the days of the week are enabled (checked). As we only want the sleep action to occur on weekends, we need to disable (uncheck) Monday, Tuesday, Wednesday, Thursday, and Friday. Click once on each weekday to disable these five days.

Power off after inactivity only on weekend

Click the Continue button to move to the Interactive Constraints step.

Power off after inactivity: Interactive Constraints

The Interactive Constraints step includes three commonly requested constraints. We are going to enable one of these: the full screen constraint.

During the weekend the Mac may be used for watching movies. Unlike most activities involving a Mac, watching a movie requires no interaction. Thus long periods of time can pass when the computer thinks you are not there; all this time the inactivity time is increasing.

To avoid the weekend inactivity triggered event putting your Mac to sleep during a movie, you need to add a constraint that will detect movie watching.

You could add a constraint listing the possible movie applications. The constraint might say If any one of QuickTime, VNC, or iTunes, is running, do not sleep. This solution is prone to problems. What if the application is just running in the background and not actually showing a movie? What if you find yourself watching a movie using another application you forgot to add to your constraint?

To overcome these potential problems, Power Manager provides a constraint that checks if the display is captured in full screen mode.

The constraint’s name describes the actions of any application that switches your Mac into full screen mode. The display is considered captured, because only the capturing application can control the screen. No other application is allowed to display any content while that one application has captured the screen.

The full screen constraint is useful not just for detecting playing movies, but also presentations, games, and other full screen activities.

Click the Display is captured in full screen mode to enable (check) the constraint.

Do not power off if the display is in full screen mode

Click the Continue button to move to the Why step.

Power off after inactivity: Why

In the Why step, enter the event name Home: inactivity sleep.

Click the Continue button to move to the Confirm step.

The Confirm step shows the weekend event ready for adding to your schedule.

Power off after inactivity: Confirm

Click the Add button to create the event and add it to your schedule.

The home/office Mac’s inactivity sleep behaviour is now complete. During the week the Mac will sleep after 20 minutes, and during the weekend the Mac will sleep after five minutes.

Two inactivity triggered sleep events; each with conditions

Thanks to the interactive constraints in the weekend event, movies and other full screen activities can still be enjoyed without your Mac going to sleep midway through.

There is no limit on how many events you can create. Events can overlap in their constraints and each will perform as expected.