Repository navigation
fix: show a turned-off widget's last output when it comes back - #950
Conversation
Turning a script widget off stopped its script and dropped its output, so turning it on again, such as by a profile that matches one app, showed nothing until the script ran again, which can take seconds for a script that calls a network service. A widget turned off now keeps its script suspended with its last output, outside the scripts the bar reads, and gets it back when it's turned on with the same command, interval, timeout and environment. The script then runs again at once. Closes #949
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
While a widget was turned off, its presentation was shown output number 0, so the parked script's last output looked new when the widget came back, and a `temporary` that had run out showed again. A widget without a script now leaves its presentation's output number as it was. The guide now says that turning a widget off pauses its script, and names everything that makes the script start afresh instead. Refs #949
Before and after
202 unchanged screens
Visual review: 202 screens, none changed. |
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
## [0.20.0](v0.19.0...v0.20.0) (2026-11-29) ### Features * animate widgets that a profile shows or hides ([#948](#948)) by @M4n0x ([eec8544](eec8544)), closes [#947](#947) [#947](#947) * log quit causes and show unexpected quits in Status ([#953](#953)) by @M4n0x ([ea5a64e](ea5a64e)), closes [#952](#952) ### Bug Fixes * choose a submenu item opened from the App menus tray ([#944](#944)) by @MaHofseth ([add49b0](add49b0)), closes [#942](#942) * draw borders in whole pixels so they keep every edge on 1x screens ([#934](#934)) by @M4n0x ([8590fcd](8590fcd)), closes [#933](#933) [#933](#933) * keep a package version installed when its folder is hidden ([#962](#962)) by @M4n0x ([2d97d15](2d97d15)), closes [#961](#961) * keep the Sound details open and smooth when picking a device ([#931](#931)) by @M4n0x ([df96453](df96453)), closes [#928](#928) [#928](#928) * keep windows clear of the bar after a double-click fills them ([#936](#936)) by @M4n0x ([c1478d1](c1478d1)), closes [#935](#935) [#935](#935) * leave the keyboard with the app while StableBar shows its menus ([#943](#943)) by @MaHofseth ([abc1c4f](abc1c4f)), closes [#941](#941) * play an app's first sound at its mixer volume ([#899](#899)) by @M4n0x ([2c38350](2c38350)), closes [#897](#897) [#897](#897) * show a turned-off widget's last output when it comes back ([#950](#950)) by @M4n0x ([6776fcb](6776fcb)), closes [#949](#949) [#949](#949) * show Countdown and Join in Settings after picking it ([#940](#940)) by @MaHofseth ([6ecaa72](6ecaa72)) * stop offering a package update that is already installed ([#956](#956)) by @M4n0x ([4592ebc](4592ebc))
|
🎉 This PR is included in version 0.20.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Problem
Turning a script widget off stopped its script and dropped its output. Turning it back on, for example through a profile that matches one app, showed nothing until the script ran again. A script that calls network services, such as the Store's AI usage package, took seconds to come back on every return to that app. Closes #949.
Changes
WidgetScripts.runno longer stops the script of a widget that is only turned off. It suspends the script and keeps it in a privateparkedtable, separate fromscripts. Code that readsscriptsfor every configured widget, such as outputbarStyleandwidgetStyles, the inspector and--query, therefore never sees a turned-off widget's output.scripts.updateSuspensionresumes it, unless scripts are paused (Pause scripts and providers while the displays sleep or the screen is locked #219). The widget shows its last output, samples and diagnostics at once, and the script runs again with theresumesender.BarPresentationgives a widget's presentation an output number only while the widget has a script. Before this, a turned-off widget's presentation was set to output 0. When the parked script came back, its old output then looked new, and atemporarythat had already expired showed again. cubic found this.docs/configuration.mdsays that turning a widget off pauses its script, and names what makes the script start afresh instead.No configuration format change.
Testing
swift build --build-tests, then the fullswift test: 293 XCTest and 1477 Swift Testing tests pass.scripts/check.sh --quickpasses.DataSourceTests:aWidgetTurnedOffAndOnAgainShowsItsLastOutputAtOnce: a profile turns the widget off for one app. The same suspended script comes back with its output, then runs again. Without the fix, this test fails.aWidgetTurnedOnAgainDoesNotReplayAnExpiredTemporary: atemporarythat expired before the widget was turned off doesn't show again when the widget comes back. Without theBarPresentationchange, this test fails.aWidgetChangedWhileTurnedOffStartsAfresh: a command changed while the widget is off gets a new script.liveModuleReloadPreservesWorkingScriptsAndRecoversAfterRepairexpected a new script object after the widget is turned back on. It now expects the same script, resumed, with outputresume. While the widget is off, it still checks that a refresh doesn't run the script.shiftReturnStartsANewLineInAnInputThatWrapsAndReturnSends, which this change doesn't touch. It passed alone three times, and the next full run passed.Not checked by hand on a running bar. The tests drive the store through the same
refreshContextpath as a focused-app change.Merging
Two commits, both
fix, which give the same release whether squashed or rebased. When squashing, keep the first commit's message, which closes #949. This PR is independent of #948, which animates the same profile changes. Either can merge first.Claude Opus 5.5 via Claude Code