Glowmoth notifications and end-of-session actions
Set up Glowmoth's ending-soon, reminder and safety notifications, choose what happens when a session ends, and run a Shortcut or shell command afterward.
Updated 6 min read
On this page
This page covers Glowmoth notifications and what Glowmoth can do when a keep-awake session ends on its own. It can turn off the display, start the screen saver, lock the screen, sleep the Mac, or run a Shortcut or shell command. All of these settings are in Glowmoth Settings ▸ Sessions. To open Settings, choose Settings… (⌘,) from the right-click menu or the panel footer.
Before you start
- Notification permission. macOS asks the first time Glowmoth schedules or posts a notification. If you declined, Settings shows "Notifications are off for Glowmoth" with an Open System Settings button. Turn Glowmoth's notifications on there.
- Automation permission is only needed if your end-of-session shell command controls another app, for example with
osascript. macOS asks the first time that command runs.
Which Glowmoth notifications you can turn on
These switches are in Settings ▸ Sessions ▸ Notifications:
| Setting | What it does | Default |
|---|---|---|
| 5 minutes before a timed session ends | Heads-up with +30 Min and +1 Hour buttons, with sound | On |
| When a session has no end time | Reminds you that the Mac is still being kept awake, after the delay set in Remind me after | Off |
| Remind me after | 1 Hour, 2 Hours, 4 Hours or 8 Hours | 4 Hours |
| When a safety limit pauses a session | Tells you when low battery or heat paused keep-awake | On |
Closed-lid mode adds one more notification. If you close the lid during an active session with that mode on, Glowmoth plays the "Glass" sound and posts "Lid closed, staying awake". See Keep a MacBook awake with the lid closed.
Two rules apply to all of these notifications:
- Clicking a Glowmoth notification opens the panel.
- The ending-soon heads-up and the no-end-time reminder only cover your own session. Glowmoth doesn't notify you before an automatic reason ends, such as a rule, an app, a folder or a coding agent.
Extend a session from the ending-soon notification
When your timed session has 5 minutes left, you get "5 minutes of awake time left" with a line like "Your Mac can sleep after 18:00."
- +30 Min adds 30 minutes to the session.
- +1 Hour adds an hour.
- If the session has already ended by the time you click, the button starts a new session of that length.
This notification only appears for a session with an end time, meaning a duration such as "1 Hour" or an "Until" time. For open-ended sessions ("Indefinitely"), turn on the reminder below. To add time without waiting for the notification, use the +15m and +1h chips in the panel. They're covered in Keep your Mac awake for a time, until a time, or indefinitely.
Get a reminder when a session has no end time
Turn on When a session has no end time and pick a delay in Remind me after. Once your open-ended session has run that long, Glowmoth shows "Still keeping your Mac awake" with the text "No end time is set. Keep it awake, or let it sleep as usual?"
- Keep Awake leaves the session running and restarts the reminder clock, so you're asked again after the same delay.
- Stop ends your session.
Safety pause notifications
With When a safety limit pauses a session on, you see "Paused: low battery" or "Paused: Mac is running hot" when a safety limit releases keep-awake. The limits and Resume Anyway (30 min) are explained in Battery and heat safety limits.
Choose what happens when a session ends
In Settings ▸ Sessions ▸ When a Session Ends, the Then menu sets the main action:
| Then | What it does |
|---|---|
| Do Nothing (default) | Nothing extra. The Mac follows its normal sleep settings |
| Turn Off the Display | Sleeps the display right away (pmset displaysleepnow) |
| Start the Screen Saver | Starts the screen saver |
| Lock the Screen | Locks immediately. If that doesn't work, it sleeps the display instead |
| Sleep the Mac | Puts the Mac to sleep (pmset sleepnow) |
The display-off and sleep actions don't need administrator rights.


When end actions run, and when they don't
The caption in Settings sums it up: "Only when a session runs out on its own, not when you stop it."
To be precise, the Then action and the Also step run when the last reason keeping the Mac awake ends on its own. That happens when:
- a timer runs out
- an app you were waiting on quits
- a download finishes
- a coding agent's cool-down ends
They do not run when keep-awake ends because:
- you stopped your session yourself, for example with Stop in the menu or the panel switch
- you clicked ✕ (End This Reason) on a reason
- you used Stop Everything
- the screen locked with End the session when the screen locks on
- you unplugged the power adapter with Stop the session when switching to battery on
- a battery or heat safety limit paused keep-awake
Because Glowmoth waits for the last reason, another reason can delay the action. For example, if your 1-hour session runs out while a watched download is still holding the Mac, nothing happens yet. The action runs once the download finishes.
Run a Shortcut or shell command at the end
The Also menu adds a step after the Then action:
| Also | What it does |
|---|---|
| Nothing Else (default) | No extra step |
| Run a Shortcut | Runs a shortcut from the Shortcuts app. Pick it from the list or enter it in the Shortcut name field |
| Run a Shell Command | Runs the command you type in the field |
When Then is Sleep the Mac, the Shortcut or command runs first and the Mac sleeps after it.
How the shell command runs
- It runs in zsh as a login shell, starting in your home folder.
- Glowmoth sets two environment variables:
GLOWMOTH_EVENTissession-ended.GLOWMOTH_REASONholds the last reason or reasons that were keeping the Mac awake.
- It can run for up to 30 seconds. After that, Glowmoth kills it.
- If the command controls another app (for example with
osascript), macOS asks for Automation permission the first time.
The field's placeholder shows a simple example:
say "Session over"To see what Glowmoth passes in, use a command that prints the variables. The output goes to the log (see the next section):
echo "$GLOWMOTH_EVENT: $GLOWMOTH_REASON"To start or stop keep-awake from your own shortcuts, see Shortcuts, Siri and the glowmoth:// URL scheme.
See the shell command's output
The command's output goes to the macOS unified log, under subsystem app.macsuite.glowmoth and category end-actions. This command shows the last hour of those entries in Terminal:
log show --info --debug --last 1h --predicate 'subsystem == "app.macsuite.glowmoth" AND category == "end-actions"'It only reads the log and changes nothing. This command shows new entries as they arrive (press Control-C to stop):
log stream --level debug --predicate 'subsystem == "app.macsuite.glowmoth" AND category == "end-actions"'You can also open the Console app and filter by the subsystem app.macsuite.glowmoth.
Troubleshooting
No Glowmoth notifications appear. Notifications are probably off for Glowmoth in macOS. If Settings shows "Notifications are off for Glowmoth", click Open System Settings and allow them. Also check that a Focus mode isn't silencing them.
The 5-minute heads-up never shows. It only applies to your own session with an end time. An open-ended session gets no heads-up, and neither does a Mac kept awake only by automatic reasons. Also check that 5 minutes before a timed session ends is on.
The end action didn't run. Check these in order:
- Check how keep-awake ended. Stopping it yourself, ✕, Stop Everything, screen lock, unplugging and safety pauses never trigger the action.
- Check whether another reason was still holding the Mac. The action waits for the last one.
- Make sure Then or Also is set to something other than Do Nothing / Nothing Else.
The shell command fails or does nothing.
- Read the
end-actionslog entries using the commands above. - Test the same command in Terminal from your home folder.
- If it takes longer than 30 seconds, Glowmoth killed it before it finished.
- If it controls another app, approve the Automation prompt. If you denied it earlier, open System Settings, search for "Automation" and allow Glowmoth again.
Your settings didn't come over to a new Mac. Export… in Settings ▸ Advanced doesn't include notification or end-action settings, so set them again on the new Mac. Reset all settings also returns them to their defaults.