Repository navigation
Closed
Labels
Description
Problem
Each surface works out its style separately, with different rules:
- Bar widgets (
Sources/StableBar/BarView.swift:238): configured style, defaults, other scripts'widgetStyles, outputstyle, outputcolor. Hover is applied afterwards in view modifiers, and an unsethoverBackgroundfalls back to the system hover colour (Sources/StableBar/Configuration.swift:176). - Workspace cells (
BarView.swift:433): their own focused/visible/empty chain and hover fallback. The underline has oneindicatorStylefor every state (BarView.swift:476). - Layout and popup blocks (
Sources/StableBar/PopupView.swift:79):styleSourceandstyleField. An unsethoverBackgroundkeeps the block's background (PopupView.swift:106), unlike bar widgets. - The bar (
BarView.swift:14): folds inbarStylefrom every script.
Because this lives in views, none of it is tested. Each new kind of state would add a layer to all four places:
- a style for the widget whose popup is open, to show which widget owns it;
- workspace indicator styles per state: the focused display, the other display, a window-manager mode;
- data states such as
warningandcriticalfor built-in providers (battery at 20 % or below, memory at 90 % or above). Native providers can't return a style, so today this means wrapping them in a script.
Proposal
- Move resolution into one pure function used by bar widgets, workspace cells, blocks and the bar, with unit tests. No behaviour change in this step.
- Add a
statesmap beside any style:{ "style": {…}, "states": { "hover": {…}, "open": {…}, "warning": {…} } }. Active states apply in a fixed order over the base style.- Interaction:
hover, andopenwhile the widget's popup shows. - Workspace:
focused,visible,empty.workspace.indicatorStylegets the same map. - Data: set by script or provider output (
"state": "warning"), or byrulescomparingvaluesorfieldsfor built-in providers, for example{ "when": { "value": "percent", "below": 0.2 }, "state": "warning" }.
- Interaction:
defaults.stateslets a theme define each state once. Document a small set of shared names (warning,critical,active,muted) so widget packages can use them without hard-coded colours.- Keep today's keys as aliases:
hoverForegroundandhoverBackgroundmap tostates.hover;focusedStyle,visibleStyleandemptyStylemap to the workspace states.
This would unlock:
- An
openstate for a popup's widget - Workspace indicator styles per state
-
stateoutput andrulesfor built-in providers - Shared state names and
defaults.statesfor themes
Possible today
Partly. Scripts can return style, styles and widgetStyles, so a script widget can colour itself by threshold or restyle another widget. Built-in providers (battery, system, audio) can't. There is no style for an open popup's widget, and the workspace underline has one style for all states. Popups already close on app and workspace switches (Sources/StableBar/BarStore.swift:50, :79).
Related
None tracked. #16 (one way to draw widgets) lets states reach the parts of built-in widgets too.
Triaged by Claude Code (Claude Opus 5.5).
Activity
M4n0x commentedon Oct 15, 2026
Performance
Today any script update re-evaluates the whole bar on every display. Each widget's style reads every script's output to apply
widgetStyles(Sources/StableBar/BarView.swift:241), and the bar reads every output forbarStyleandhidden(BarView.swift:14,:31).Requirements for this change:
ruleswhen output arrives, not on every render.Self._printChanges()that an update touching one widget doesn't re-evaluate the others, and note the result in the pull request.Triaged by Claude Code (Claude Opus 5.5).
stablebar-releases commentedon Oct 21, 2026
🎉 This issue has been resolved in version 0.5.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀