Skip to content

treat idle inhibitors as user activity#159

Draft
AllanChain wants to merge 5 commits into
mainfrom
idle-inhibitor
Draft

treat idle inhibitors as user activity#159
AllanChain wants to merge 5 commits into
mainfrom
idle-inhibitor

Conversation

@AllanChain

@AllanChain AllanChain commented Jul 19, 2026

Copy link
Copy Markdown
Owner

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 PauseReason or app-layer changes):

  1. Wayland (native switch): select ext-idle-notify v1 get_idle_notification (compositor respects zwp_idle_inhibitor_v1 — the only way to catch mpv/VLC) for InhibitorAware, or v2 get_input_idle_notification (input-only) for InputOnly. Recreate the notification object on mode change.

  2. Polling backends (GNOME / X11 / macOS / Windows): wrap the raw idle reader in a shared IdleReader that, in InhibitorAware mode, 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. In InputOnly mode the raw reader passes through unchanged.

  3. Per-platform inhibitor detection feeds a cached bool inhibited flag to the wrapper:

    Platform Source
    Linux logind ListInhibitors(idle) via D-Bus PropertiesChanged + KDE PowerDevil PolicyAgent.ActiveInhibitions (complementary — logind misses portal-routed inhibitors on KDE)
    X11 XScreenSaverQueryInfo.state == ScreenSaverDisabled (free, same call as idle)
    macOS IOPMCopyAssertionsByProcessPreventUserIdleDisplaySleep, slow-timer-cached
    Windows CallNtPowerInformation(SystemExecutionState)ES_DISPLAY_REQUIRED (documented, no admin, covers both legacy SetThreadExecutionState and modern PowerSetRequest)

This is purely vibed with only basic checks for code sanity. More tests and checks are needed.

Fixes #157.

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 option to use Wayland get_idle_notification

1 participant