You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: list macOS notifications that widget scripts can subscribe to - #737
Script events accept any distributed notification name, but the guide named only Spotify's, so people poll for changes that macOS already announces. Closes#303.
Changes
Under Script events in docs/create-a-widget.md:
A table of four notification names that work on current macOS, with when each is sent and what INFO holds.
A note that these names belong to macOS and the apps that send them, which can change them.
The --trigger paragraph now says that a trigger posts a distributed notification with its name, so trigger names share that space.
How each name was checked, on macOS 27.2.1:
com.apple.screenIsLocked and com.apple.screenIsUnlocked: the system log shows loginwindow posting both with sendDistributedNotification:object: and object 501, with no payload, so INFO is not set. StableBar listens to both (StableBarApp.swift, BarStore.swift).
AppleInterfaceThemeChangedNotification: StableBar listens to it (SystemContext.swift), and the name is in the system libraries. I didn't observe its payload, since switching the appearance was off limits. "Not set" rests on the code that observes it, which reads the AppleInterfaceStyle default instead of a payload.
com.apple.Music.playerInfo: the name is in Music's binary. The Player State key comes from projects that observe this notification and its iTunes predecessor (distnote), and the rule that Music posts nothing for a skip while paused comes from Ember#527. I didn't observe its payload, since playing music was off limits.
Left out: com.apple.screensaver.didstart and com.apple.screensaver.didstop. Both names are in the ScreenSaver framework, but the system log holds no post of either, and a report says Sonoma stopped sending com.apple.screensaver.willstop, so I couldn't back them.
Testing
scripts/check.sh --quick passes.
swift test --filter builtInEventsMatchTheGuideTable passes. It reads the event table just above the new one.
Not checked: the Music payload. StableBar turns a payload into INFO with JSONSerialization, which raises an uncaught exception on a date: a scratch test stops with Invalid type in JSON write (__NSTaggedDate). Music's binary contains a Play Date string. Before merging, play a track with a widget subscribed to com.apple.Music.playerInfo, and check that the bar keeps running and INFO holds JSON.
No actionable comments were generated in the recent review.
Walkthrough
The Script events guide distinguishes built-in events from distributed notification subscriptions. It adds four example notification names and explains that --trigger posts a distributed notification.
Changes: Script event documentation
Layer / File(s)
Summary
Document event and trigger behavior docs/create-a-widget.md
The guide separates built-in events from distributed notification subscriptions, lists four example notifications with their triggers and INFO values, and states that --trigger names share the distributed notification namespace.
Possibly related issues
Seb-GRAF/StableBar#748 — The guide documents com.apple.Music.playerInfo, but this change does not fix the reported crash when the notification payload contains a Date.
Severity of issue fixed: Low
Merge Risk: Minimal · up to 65a3a
This change updates the Script events guide with example notification names and clarifies that trigger names share the notification namespace. It is documentation only and has no runtime impact. The author notes that the Music payload is not yet verified by a playback test.
Pre-merge checks: 3
Check name
Status
Explanation
Description check
The description follows the template closely. It has a Problem section that states the issue and links #303 via "Closes #303". It has a Changes section that lists the table, the macOS note, and the --…
Linked Issues check
Issue #303 asks for documentation only: a table under Script events of notification names, when each is sent, and what INFO holds; a note that macOS and sending apps can change these names; and a stat…
Out of Scope Changes check
The whole-PR scope is a documentation change under the Script events section of docs/create-a-widget.md (summary: +13/-2, docs only, no declaration changes). Each change maps to an objective of #303: …
Full details: Description check
Explanation
The description follows the template closely. It has a Problem section that states the issue and links #303 via "Closes #303". It has a Changes section that lists the table, the macOS note, and the --trigger clarification, with reasons for each. It has a Testing section that reports the checks run, the untested Music payload, and the remaining risk. It has a Merging section that states the merge method (any method, one docs: commit). The last line names the model and harness, as the template requires. The description is thorough and specific, and it matches the raw summary and the PR objectives.
Full details: Linked Issues check
Explanation
Issue #303 asks for documentation only: a table under Script events of notification names, when each is sent, and what INFO holds; a note that macOS and sending apps can change these names; and a statement that --trigger names share the notification space. No coding or automated-test requirement is stated, so no coding requirements apply. The reviewed head of docs/create-a-widget.md contains the table with com.apple.screenIsLocked, com.apple.screenIsUnlocked, AppleInterfaceThemeChangedNotification and com.apple.Music.playerInfo, each with a sent-when and INFO entry. It also contains the note that these names belong to macOS and the sending apps, and the --trigger sentence stating that trigger names share one space with macOS and app notification names. Deviations from the issue's proposal are documented in the PR description and are acceptable: the names were checked on macOS 27.2.1 instead of macOS 26, and the two screensaver names were omitted because no system-log post was found. The issue lists those names as candidates to check before listing. The Music INFO entry ('as JSON') is not verified against a live payload, as the PR states. That is a documentation accuracy risk, not a missing coding requirement.
Full details: Out of Scope Changes check
Explanation
The whole-PR scope is a documentation change under the Script events section of docs/create-a-widget.md (summary: +13/-2, docs only, no declaration changes). Each change maps to an objective of #303: the notification table, the macOS-ownership note, and the --trigger namespace sentence. The PR description states the change is one docs commit. No unrelated changes were identified in the reviewed head file content. The diff operation was unavailable, so the check relied on the supplied summary and the head file content, not on a text diff against the merge base.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 62b68f3 and 65a3ad6.
Files selected for processing: 1
docs/create-a-widget.md
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Script
eventsaccept any distributed notification name, but the guide named only Spotify's, so people poll for changes that macOS already announces. Closes #303.Changes
Under Script events in
docs/create-a-widget.md:INFOholds.--triggerparagraph now says that a trigger posts a distributed notification with its name, so trigger names share that space.How each name was checked, on macOS 27.2.1:
com.apple.screenIsLockedandcom.apple.screenIsUnlocked: the system log shows loginwindow posting both withsendDistributedNotification:object:and object501, with no payload, soINFOis not set. StableBar listens to both (StableBarApp.swift,BarStore.swift).AppleInterfaceThemeChangedNotification: StableBar listens to it (SystemContext.swift), and the name is in the system libraries. I didn't observe its payload, since switching the appearance was off limits. "Not set" rests on the code that observes it, which reads theAppleInterfaceStyledefault instead of a payload.com.apple.Music.playerInfo: the name is in Music's binary. ThePlayer Statekey comes from projects that observe this notification and its iTunes predecessor (distnote), and the rule that Music posts nothing for a skip while paused comes from Ember#527. I didn't observe its payload, since playing music was off limits.Left out:
com.apple.screensaver.didstartandcom.apple.screensaver.didstop. Both names are in the ScreenSaver framework, but the system log holds no post of either, and a report says Sonoma stopped sendingcom.apple.screensaver.willstop, so I couldn't back them.Testing
scripts/check.sh --quickpasses.swift test --filter builtInEventsMatchTheGuideTablepasses. It reads the event table just above the new one.INFOwithJSONSerialization, which raises an uncaught exception on a date: a scratch test stops withInvalid type in JSON write (__NSTaggedDate). Music's binary contains aPlay Datestring. Before merging, play a track with a widget subscribed tocom.apple.Music.playerInfo, and check that the bar keeps running andINFOholds JSON.Merging
Any method: one
docs:commit.Claude Opus 5.5 via Claude Code (T3 Code)