Restore previously-removed activity assertions (fixes #44, likely fixes #43) - #50
Open
timokox wants to merge 1 commit into
Open
Restore previously-removed activity assertions (fixes #44, likely fixes #43)#50timokox wants to merge 1 commit into
timokox wants to merge 1 commit into
Conversation
Commit e9ef994 shifted Zen jiggle to a single IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep) call and removed two older activity signals: 1. IOPMAssertionDeclareUserActivity(..., kIOPMUserActiveLocal, ...) 2. A no-move CGEventMouseMoved post (macOS 15+) in the Zen jiggle path Per the maintainer's note on the issue, these are likely why apps such as Microsoft Teams (bhaller#43) stopped staying awake after that change. The various assertion APIs target different layers of macOS's activity tracking, so emitting all of them in parallel maximises coverage. Restores both signals while keeping the new kIOPMAssertionTypePreventUserIdleDisplaySleep assertion. The no-move event post is also hardened to NULL-check CGEventCreateMouseEvent before posting.
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 #44. Likely also fixes #43 (Teams not staying awake under Zen jiggle).
Per the maintainer's own note on #44:
This PR restores those two signals while keeping the new
IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, …)assertion that fixed Zen jiggle.What's restored
IOPMAssertionDeclareUserActivity(CFSTR("Jiggler"), kIOPMUserActiveLocal, &id)— added back inside-declareUserActivity, alongside the new assertion. This is a separate, self-managing API; the assertion ID is reused across calls and refreshed internally by the OS.CGEventMouseMovedpost (macOS 15+) — restored in thejiggleStyle == 1(Zen jiggle) branch of-periodicJiggleStatusCheck:. Suppression interval is saved/restored as before.The various activity-signalling APIs target different layers of macOS's idle tracking, so emitting all of them in parallel maximises the chance that any given app (Teams, etc.) sees the signal it cares about.
Hardening
The no-move
CGEventMouseMovedblock now NULL-checksCGEventCreateMouseEventbefore posting, matching the defensive style used in the click-jiggle branch a few lines below.Notes
-declareUserActivity/-undeclareUserActivitylifecycle, so behaviour around state changes (e.g.setJigglingActive:NOreleasing the assertion) is unchanged.UpdateSystemActivity(UsrActivity)(already present, kept in the existing code) continues to run; this PR is purely additive on top of that.