Module for creating and displaying macOS system notifications.
macOS notifications require user permission before they will appear. Request it once
(typically at startup) via hs.permissions.requestNotifications() and it will be
remembered across sessions:
hs.permissions.requestNotifications().then(granted=> { if (granted) hs.notify.show("Hammerspoon", "Notifications are enabled!") })
Quick notification
// Fire and forget hs.notify.show("Build complete", "Your project compiled successfully.")
// With a callback invoked when the user interacts hs.notify.show("Build complete", "Click to view the log.", (response) => { console.log("User tapped:", response.actionIdentifier) })
The callback function receives an HSNotificationResponse, and create() takes an
HSNotificationOptions.
Triggers
Pass a trigger object in create()'s options to schedule the notification instead of delivering it
Time interval — deliver after a fixed delay in seconds (minimum 60 s):
trigger: { type: "timeInterval", interval: 300 }
Calendar — deliver at a specific date/time. Provide either a JS Date object or individual
date-component keys; any omitted component matches every value:
// At a specific moment trigger: { type: "calendar", date: newDate("2026-06-01T09:00:00") }
// At 09:00 on the next day that matches (e.g. next Monday, weekday 2) trigger: { type: "calendar", weekday: 2, hour: 9, minute: 0 }
Module for creating and displaying macOS system notifications.
macOS notifications require user permission before they will appear. Request it once (typically at startup) via
hs.permissions.requestNotifications()and it will be remembered across sessions:Quick notification
Rich notification
The
callbackfunction receives anHSNotificationResponse, andcreate()takes anHSNotificationOptions.Triggers
Pass a
triggerobject increate()'s options to schedule the notification instead of delivering it Time interval — deliver after a fixed delay in seconds (minimum 60 s):Calendar — deliver at a specific date/time. Provide either a JS
Dateobject or individual date-component keys; any omitted component matches every value:Supported component keys:
year,month,day,hour,minute,second,weekday.