Conversation
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
3 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1911
After display or system sleep,
soberNow()restartedjob()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
xcodebuild -scheme MonitorControl -configuration Debug(signing disabled; with Xcode 27 I had to passMACOSX_DEPLOYMENT_TARGET=12.0on the command line, the project itself is unchanged).--lint: no issues. SwiftLint reports the same two existingopening_bracewarnings inAppDelegate.swiftas onmain.job(),sleepNotification()andsoberNow(). 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.