treat idle inhibitors as user activity#159
Draft
AllanChain wants to merge 5 commits into
Draft
Conversation
But keep inhibitor ignore during break window
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.
Idle inhibitors, specifically those keeping the display on, are a good indication that the user is actively using the computer. We check if there are any idle inhibitors and treat them as user activity and disable "auto pause on idle" by default. But we keep ignoring the inhibitor during the break window because the transitions are really driven by true user activity.
Approach — hybrid, encapsulated entirely in the idle backend (no new
PauseReasonor app-layer changes):Wayland (native switch): select
ext-idle-notifyv1get_idle_notification(compositor respectszwp_idle_inhibitor_v1— the only way to catch mpv/VLC) forInhibitorAware, or v2get_input_idle_notification(input-only) forInputOnly. Recreate the notification object on mode change.Polling backends (GNOME / X11 / macOS / Windows): wrap the raw idle reader in a shared
IdleReaderthat, inInhibitorAwaremode, holds reported idle at 0 while an inhibitor is active and uses a baseline reset on release so the user isn't break-bombed the instant a video ends. InInputOnlymode the raw reader passes through unchanged.Per-platform inhibitor detection feeds a cached
bool inhibitedflag to the wrapper:ListInhibitors(idle)via D-BusPropertiesChanged+ KDE PowerDevilPolicyAgent.ActiveInhibitions(complementary — logind misses portal-routed inhibitors on KDE)XScreenSaverQueryInfo.state == ScreenSaverDisabled(free, same call as idle)IOPMCopyAssertionsByProcess→PreventUserIdleDisplaySleep, slow-timer-cachedCallNtPowerInformation(SystemExecutionState)→ES_DISPLAY_REQUIRED(documented, no admin, covers both legacySetThreadExecutionStateand modernPowerSetRequest)This is purely vibed with only basic checks for code sanity. More tests and checks are needed.
Fixes #157.