Skip to content

Restart the brightness job after sleep on Intel Macs - #1915

Open
Blizzeq wants to merge 1 commit into
MonitorControl:mainfrom
Blizzeq:fix/1911-restart-job-after-sleep
Open

Blizzeq wants to merge 1 commit into
MonitorControl:mainfrom
Blizzeq:fix/1911-restart-job-after-sleep

Conversation

@Blizzeq

@Blizzeq Blizzeq commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Fixes #1911

After display or system sleep, soberNow() restarted job() only when the displays needed reconfiguration or on Apple silicon. On an Intel Mac with no reconfiguration the loop that ended during sleep never came back, so syncing brightness from the built-in display stopped until a relaunch, as @LuisMa9L traced in the issue. This restarts the job in that case too and keeps the AVServices update Apple silicon only. job(start:) already returns early when the loop is still running, so a quick wake does not start a second loop.

Testing

  • Builds with xcodebuild -scheme MonitorControl -configuration Debug (signing disabled; with Xcode 27 I had to pass MACOSX_DEPLOYMENT_TARGET=12.0 on the command line, the project itself is unchanged).
  • SwiftFormat --lint: no issues. SwiftLint reports the same two existing opening_brace warnings in AppDelegate.swift as on main.
  • There's no test target, so I checked the control flow with a small standalone Swift model of job(), sleepNotification() and soberNow(). Before the change, Intel with no reconfiguration and the loop stopped during sleep ends with no running job; after it, every combination of architecture, reconfiguration and wake timing ends with exactly one running loop. I'm on Apple silicon, so I couldn't reproduce the Intel case on hardware.

soberNow() only restarted job() when displays needed reconfiguration or on Apple silicon, so on Intel the loop that syncs brightness from the built-in display stayed stopped after display or system sleep. Restart it whenever no reconfiguration is pending; job(start:) already ignores the call if the loop is still running.

Fixes MonitorControl#1911

This branch has not been deployed

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

Labels

in progress Issue currently being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Brightness sync never resumes after display/system sleep on Intel Macs (soberNow doesn't restart job)

2 participants