Repository navigation
Closed as duplicate
Labels
Description
Problem
Scripts can subscribe to eight built-in events (BuiltInEvents.swift:4-5) and to distributed notifications. Three changes that StableBar already handles inside aren't sent to them:
- Displays. Connecting, disconnecting or rearranging displays rebuilds the bars in
screensChanged(StableBarApp.swift:282-291), but a script that shows something per display, or changes when the Mac docks, only finds out on its next poll. SketchyBar sendsdisplay_change, and yabaidisplay_addedanddisplay_removed. - Active profiles. They change with the appearance, power source, displays and front app, and
--querylists them, but no event is sent, so a script that behaves differently per profile has to poll. - Popups. A widget whose popup lists something slow to fetch, such as open pull requests, polls to keep the popup current, even when nobody opens it. SwiftBar's
refreshOnOpenrefreshes a plugin as its menu opens.
Proposal
displayChange: sent after the bars are rebuilt for a new set of displays.INFOis the number of displays.profileChange: sent when the active profiles change.INFOis a JSON array of their names.popupOpenandpopupClose:INFOis the widget's ID, so a widget's script can refresh when its own popup opens.- The table under Script events in docs/create-a-widget.md lists them;
builtInEventsMatchTheGuideTablechecks it. - Open question: should a widget subscribed to
popupOpenhear only its own popup, so other popups don't run its script?
Possible today
No for profiles and popups. For displays, a polling script can compare system_profiler SPDisplaysDataType output.
Related
- Pause scripts and providers while the displays sleep or the screen is locked #219 pauses scripts while the displays sleep; that is the displays sleeping, not changing.
- Let commands set conditions that profiles match, such as the current Focus #81 adds context values that profiles match.
- Follow the bar's events and state from the command line #299 would stream these events to the command line.
Triaged by Claude Code (Claude Opus 5.5).
Activity
Seb-GRAF commentedon Nov 11, 2026
same events as #299, keeping them there so scripts and
--subscribeget them from one place