Add automatic lid control with keyboard dimming and lock-on-open - #16
Open
ziyad-aljohani wants to merge 6 commits into
Open
Add automatic lid control with keyboard dimming and lock-on-open#16ziyad-aljohani wants to merge 6 commits into
ziyad-aljohani wants to merge 6 commits into
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.
Normal idle-sleep prevention does not keep a Mac awake when its lid closes. This adds an Automatic lid control checkbox that follows Caffeine's existing activation toggle:
A limited privileged helper requests administrator approval on first installation and manages the system sleep override through a renewable lease. It restores ordinary sleep after deactivation, lease expiration, or client failure, and recovers its recorded override after a helper restart. Rapid off/on cycles wait for the previous session to finish cleanup. The version-2 helper fixes intermittent deactivation caused by reading the clock before a concurrently renewed lease timestamp, and publishes status atomically. Lease renewal runs on a dedicated serial queue with App Nap disabled during the session, so a delayed UI loop does not expire the lease. Existing version-1 installations need one administrator approval for the helper upgrade; later toggles do not prompt. The change also replaces the intermittent idle-sleep assertion with a continuous assertion and adds Arabic and English strings, build/uninstall scripts, and implementation documentation.
Distribution and compatibility
This implementation is a direct-distribution fork: it disables App Sandbox and upstream Sparkle updates, and its build script uses a separate bundle identifier. The Xcode project is unchanged. It uses private Apple brightness and lock interfaces, targets macOS 14.6+, and the supplied build script produces an ad-hoc-signed universal app, not a notarized release. These distribution choices will need maintainer review before inclusion in upstream releases.
The helper authorizes the installing user rather than a specific app signature, supports one installing account, and uses a global power setting. Existing external sleep overrides are treated as conflicts. The black cover and lock confirmation reduce the reopening exposure, but hardware and OS timing still require physical validation; this is not a universal zero-frame privacy guarantee. See
docs/PROTECTED-LID.mdfor recovery, removal, and limitations.Validation