Skip to content

Restore previously-removed activity assertions (fixes #44, likely fixes #43) - #50

Open
timokox wants to merge 1 commit into
bhaller:masterfrom
timokox:fix-restore-activity-assertions
Open

Restore previously-removed activity assertions (fixes #44, likely fixes #43)#50
timokox wants to merge 1 commit into
bhaller:masterfrom
timokox:fix-restore-activity-assertions

Conversation

@timokox

@timokox timokox commented May 22, 2026

Copy link
Copy Markdown

Fixes #44. Likely also fixes #43 (Teams not staying awake under Zen jiggle).

Per the maintainer's own note on #44:

In commit e9ef994 the issue with Zen jiggle was fixed by shifting to a different way of asserting activity. Two older ways of asserting activity were removed in that commit. I think those two older ways should be added back in… It's best to indicate activity in all possible ways, for maximum coverage.

This PR restores those two signals while keeping the new IOPMAssertionCreateWithName(kIOPMAssertionTypePreventUserIdleDisplaySleep, …) assertion that fixed Zen jiggle.

What's restored

  1. 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.
  2. No-move CGEventMouseMoved post (macOS 15+) — restored in the jiggleStyle == 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 CGEventMouseMoved block now NULL-checks CGEventCreateMouseEvent before posting, matching the defensive style used in the click-jiggle branch a few lines below.

Notes

  • No change to the dedicated -declareUserActivity / -undeclareUserActivity lifecycle, so behaviour around state changes (e.g. setJigglingActive:NO releasing 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add old activity assertions back in a shorter "standard jiggle" minimum distance would be helpful (Microsoft Teams issue)

1 participant