Make the lock action sleep displays immediately - #3
Open
LorenzGit wants to merge 1 commit into
Open
Conversation
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.
Problem
When Code Awake is active,
Allow Lock & Sleepreplaces thePreventUserIdleDisplaySleepassertion withPreventUserIdleSystemSleep. This permits display sleep while keeping the Mac awake, but it does not actively turn the displays off.The displays therefore remain on until the normal macOS display-sleep timer expires. macOS may also hold its own
com.apple.powermanagement.delayDisplayOffassertion for a grace period after locking.The existing lock button did not close that gap. It ran:
/usr/bin/open -a ScreenSaverEngineCGSession -suspendhelperThose commands lock or show the login screen, but neither requests display sleep. The
CGSessionexecutable is also absent on newer macOS versions. The result can be a locked Mac with the monitors still lit.Change
The explicit lock action now runs these commands sequentially:
ScreenSaverEngine.CGSession -suspendwhen that legacy executable exists./usr/bin/pmset displaysleepnow.Missing executables and launch failures do not stop the remaining commands. This preserves compatibility with older macOS versions while ensuring the final display-sleep request still runs.
pmset displaysleepnowpowers off the displays. It does not put the whole Mac to sleep. Code Awake continues holdingPreventUserIdleSystemSleep, so the Mac remains awake for running tasks.This PR also updates the tooltip, welcome text, and README to distinguish the two behaviors:
Allow Lock & Sleeppassively follows the normal macOS display-sleep schedule.The assertion policy behind the toggle is unchanged.
Verification
git diff --checkpasses.Related to #2.