Skip to content

Sleep the pointer timer when the mouse is still - #26

Open
trussosw wants to merge 1 commit into
nilbuild:mainfrom
trussosw:battery-idle-sleep
Open

trussosw wants to merge 1 commit into
nilbuild:mainfrom
trussosw:battery-idle-sleep

Conversation

@trussosw

Copy link
Copy Markdown

With the pointer on and the mouse still, the overlay kept ticking at 20 Hz indefinitely, and resting the mouse over the Dock kept the 120 Hz timer running for as long as it sat there.

Changes

  • After 3 s without movement, stop the timer entirely. The existing idle monitors (mouse moved, button down, modifier changed) already wake it, so nothing is missed.
  • A still mouse over the Dock stops counting as busy after 3 s.
  • The 20 Hz idle timer gets a tolerance so macOS can batch wakeups.
  • TinyHand.log starts fresh once it passes 1 MB; it grew without limit before.

Pointer off is unchanged (no timers ran there already).

Testing: builds with swift build on macOS (Apple Silicon). Running it daily in a personal build; the pointer wakes immediately on movement after sleeping.

🤖 Generated with Claude Code

With the pointer on and the mouse still, the overlay kept ticking at
20 Hz forever, and resting over the Dock kept the 120 Hz timer running
for as long as the mouse sat there.

- After 3 s without movement, stop the timer entirely. The idle
  monitors (mouse moved, button down, modifier changed) already wake it.
- Stop treating a still mouse over the Dock as busy after 3 s.
- Give the 20 Hz idle timer tolerance so macOS can batch wakeups.
- Start a fresh TinyHand.log once it passes 1 MB.

Pointer off is unchanged (no timers ran there already).

Co-Authored-By: Claude Opus 5.5 <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.

1 participant