Skip to content

fix: avoid background HID polling resetting system idle timers#225

Open
ArtisticZhao wants to merge 1 commit into
TomBadash:masterfrom
ArtisticZhao:master
Open

fix: avoid background HID polling resetting system idle timers#225
ArtisticZhao wants to merge 1 commit into
TomBadash:masterfrom
ArtisticZhao:master

Conversation

@ArtisticZhao

Copy link
Copy Markdown

Summary

This changes Mouser's background HID polling so it no longer keeps resetting the OS idle timer while the app is hidden or the user is inactive.

The issue appears to come from periodic HID++ reads, especially SmartShift polling, being interpreted by the OS as user activity. That prevents display timeout and system sleep even when the mouse and keyboard are untouched.

Changes

  • Gate background battery / SmartShift HID reads behind frontend visibility.
  • Skip background HID polling once the system has been idle for a grace period.
  • Avoid repeated background polls unless there has been real user activity since the last poll.
  • Increase background polling intervals to reduce unnecessary HID traffic.
  • Track QML window visibility, including minimized state, and pass it to the engine.
  • Add tests covering hidden frontend, idle system state, and repeated polling without user activity.

Related

Related to #178.

The discussion there identified periodic HID++ reads, especially SmartShift polling, as a likely cause of the OS idle timer being reset while Mouser runs in the background. This PR makes those background reads visibility- and idle-aware, and I manually verified the macOS sleep behavior after building the updated app locally.

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