Skip to content

Pause data services while the dashboard is hidden - #36

Open
edward-mcnair wants to merge 1 commit into
kemalandic:mainfrom
edward-mcnair:pause-hidden-work
Open

edward-mcnair wants to merge 1 commit into
kemalandic:mainfrom
edward-mcnair:pause-hidden-work

Conversation

@edward-mcnair

Copy link
Copy Markdown

What does this PR do?

When the displays sleep, or the dashboard waits for its display, nothing is on screen to update. Even so, metrics, network, disk, SMC, process, Wi-Fi, Bluetooth and Now Playing kept polling all night; Now Playing runs an AppleScript helper every 5 s.

  • AppModel.suspendBackgroundWork() stops them when the dashboard is parked or its display is missing.
  • resumeBackgroundWork() restarts them when it's placed again.
  • Touch keeps running. Widgets added while suspended start on resume.
  • The staggered start re-checks, after its delay, that the service is still wanted and nothing was suspended in between. Before, removing a widget (or undoing an add) within that delay left the service polling, with nothing to stop it.

Tests: none new. The behaviour lives in AppModel, whose services can't run headless in the test target. Running on a XENEON EDGE in a fork through sleep, wake and screen lock.

Screenshots

No UI change.

Checklist

  • Tested on macOS 14+ (macOS 27)
  • No third-party dependencies added
  • Follows existing code style (swift-format lint clean)

Note: overlaps #30 in retryRepin; I'll rebase whichever lands second.

🤖 Generated with Claude Code

When the displays sleep or the dashboard waits for its display, nothing
is on screen to update, but metrics, network, disk, SMC, process, Wi-Fi,
Bluetooth and Now Playing kept polling (Now Playing runs an AppleScript
helper every 5 s) all night.

AppModel.suspendBackgroundWork() stops them when the dashboard is parked
or its display is missing; resumeBackgroundWork() restarts them when it is
placed again. Touch keeps running. Widgets added while suspended start on
resume.

The staggered start also re-checks, after its delay, that the service is
still wanted and that nothing suspended in between. Before, removing a
widget (or undoing an add) within that delay left the service polling
with nothing to stop it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant