Skip to content

docs: list macOS notifications that widget scripts can subscribe to - #737

Merged
Seb-GRAF merged 2 commits into
mainfrom
docs/303-script-notification-names
Nov 17, 2026
Merged

Seb-GRAF merged 2 commits into
mainfrom
docs/303-script-notification-names

Conversation

@Seb-GRAF

Copy link
Copy Markdown
Collaborator

Problem

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.

Merging

Any method: one docs: commit.

Claude Opus 5.5 via Claude Code (T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

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: Passed 3

Check name Status Explanation
Description check Passed 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 Passed 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 Passed 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.

Share

Recent review info

Run configuration

Commits

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.

@Seb-GRAF
Seb-GRAF merged commit d9eed2c into main Nov 17, 2026
17 checks passed
@Seb-GRAF
Seb-GRAF deleted the docs/303-script-notification-names branch November 17, 2026 09:16
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.18.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List the macOS notifications that widget scripts can subscribe to

1 participant