Skip to content

fix(auto-away): stop spurious away toggling and restore on input#6

Merged
math65 merged 1 commit into
math65:mainfrom
xogium:fix-away
May 20, 2026
Merged

fix(auto-away): stop spurious away toggling and restore on input#6
math65 merged 1 commit into
math65:mainfrom
xogium:fix-away

Conversation

@xogium
Copy link
Copy Markdown
Contributor

@xogium xogium commented May 20, 2026

Summary

  • Fix automatic Away status flipping back to Available within seconds without user input, caused by unreliable IOKit HIDIdleTime reads (failures returned 0 and looked like activity).
  • Use CGEventSource keyboard/mouse idle tracking and require a sharp idle drop from a tracked peak before clearing Away, with a short post-activation grace period to ignore status-change glitches.
  • Poll every 0.5s while Away so keypresses restore Available promptly; keep 5s polling when not away.

Test plan

  • Set auto-away timeout to 1–3 minutes, stay idle until Away is applied, confirm status stays Away without touching keyboard/mouse
  • Press a key or click the mouse while Away; confirm status returns to Available within ~1s
  • Set auto-away timeout to 0; confirm manual Away/Available still works
  • Change Away status message manually while auto-away is active; confirm no spurious toggling

Made with Cursor

Replace unreliable IOKit HIDIdleTime reads with CGEventSource keyboard and
mouse idle tracking. Failed samples no longer clear away as fake activity;
return requires a sharp idle drop from a tracked peak after a short
post-activation grace period. Poll every 0.5s while away so keypresses
restore Available promptly.

Co-authored-by: Cursor <cursoragent@cursor.com>
@xogium
Copy link
Copy Markdown
Contributor Author

xogium commented May 20, 2026

I've just tested this and can confrim the implemented fix actually works out just fine on my end.

Without this fix, auto away would enable itself, then almost immediately get disabled without any action on the user's part, which rendered the feature broken and of not much use.

@math65 math65 merged commit b1e3f62 into math65:main May 20, 2026
math65 added a commit that referenced this pull request May 20, 2026
Ships PR #6 (xogium): replaces IOKit HIDIdleTime with CGEventSource
idle tracking, adds peak/sharp-drop logic to ignore transient idle
glitches, and tightens polling to 0.5s while Away for fast
restore-on-input.

Doubles as the first proper test of Sparkle's update cycle now that
1.1.2 has the entitlement fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants