Skip to content

Don't treat pointer motion right after an output change as lock-screen activity - #10343

Open
johnkattenhorn wants to merge 1 commit into
omacom:quattrofrom
johnkattenhorn:fix/lock-motion-wake-after-output-change
Open

johnkattenhorn wants to merge 1 commit into
omacom:quattrofrom
johnkattenhorn:fix/lock-motion-wake-after-output-change

Conversation

@johnkattenhorn

Copy link
Copy Markdown

What happens

A monitor that deep-sleeps on DPMS-off (many Dell/ViewSonic/BenQ panels) drops its link a few seconds after the lock screen blanks, then re-handshakes and returns. Hyprland re-adds the output lit, the lock surface is rebuilt for it, and the rebuild can deliver synthetic pointer motion to LockView's full-surface MouseArea. That motion counted as user activity: runWake() lit every display and re-armed the 5s blank, closing a wake/blank loop that runs for as long as the session stays locked.

Measured on an AMD Cezanne APU with dual Dell 4K monitors on HDMI (Omarchy 4.0.2-1, Hyprland 0.56.2): ~10s period, from lock at 21:29 to unlock at 07:11 without a break — 4,182 hotplug cycles in one day. Related reports: #8863, #8689, #8580, #8946.

Beyond the visible light show, every cycle re-sends zwp_linux_dmabuf_feedback_v1 to all Wayland clients, and gtk4 4.22.x's dmabuf munmap bug (fixed on GTK master in a8a5692c, not backported to gtk-4-22) turns each one into a crash roll — this machine collected 12 ghostty and several nautilus coredumps in a week, symbolized to exactly that GTK frame.

Why not a time-since-blank debounce

#8896 debounces unforced wakes for 1.5s after the blank, which covers vectors that fire immediately. But the link drop lands at ~2s here, ~11s on a Navi 32 report in #8863, and ~19s in #8580 — a blank-relative window has to be very long to cover the spread, and a long window swallows real users. The output change itself is the reliable anchor: whenever the drop happens, the synthetic motion arrives right after the screens change.

Fix

  • LockView gains a dedicated motionWakeRequested() signal; pointer motion emits it, while clicks and keys stay on wakeRequested().
  • The service stamps lastScreensChangeAt on every Quickshell.onScreensChanged.
  • Motion within 10s of a screens change re-arms the blank timer — so a returning monitor that comes back lit goes dark again — instead of waking the desk. Motion outside the window wakes as before. Clicks and keys always wake immediately, so a real person at the desk is never locked out of waking the display.

This closes the lock-surface wake vector. It deliberately composes with, rather than replaces, the in-flight work on the neighbouring vectors: #9152 (idle service waking a locked session's display) and #8581 (re-arming the blank for returning monitors with backoff). On the hardware above, the journal evidence shows both the lock-surface and idle-service vectors firing; both fixes are needed for a fully quiet night.

Tests

test/shell.d/lock-motion-wake-gate-test.sh asserts the signal split, the stamp, the gate, and that the deliberate-input paths are untouched. Existing lock tests pass.

🤖 Generated with Claude Code

…n activity

A monitor that deep-sleeps on DPMS-off drops its link a couple of seconds
after the lock blanks, then re-handshakes and returns. Rebuilding the lock
surface for the returning output can deliver synthetic pointer motion to
LockView's MouseArea, which counted as user activity: runWake() lit every
display and re-armed the 5s blank, closing a wake/blank loop that runs for
as long as the session stays locked (~10s period measured; 4,182 hotplug
cycles logged in a single day, and each one re-sends dmabuf feedback to
every Wayland client, which crashes GTK4 apps under gtk4 4.22.x's dmabuf
munmap bug).

Give pointer motion its own signal and gate it: motion within 10s of a
screens change re-arms the blank, so a monitor that comes back lit goes
dark again, and does not wake the desk. Clicks and keys are deliberate
and keep waking immediately.

Complements omacom#9152 (idle service side) and omacom#8581 (re-blank of returning
monitors); addresses the wake half of omacom#8863/omacom#8689/omacom#8580 for wake vectors
that fire later than the 1.5s post-blank debounce in omacom#8896 covers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V7dqWeWCgwYfUR3xEV6vT2
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed against quattro by reading it alongside #8863, #8580 and the other open fixes for that bug. Nothing was run on a worker, because of the conclusion below.

Another open pull request is the better fix for this bug: #13129. This pull request stops pointer motion within 10s of a screens change from waking the lock. Instead, that motion re-arms the blank timer. That keeps the other displays dark, but it does not stop the hotplug. Trace one cycle through shell/plugins/lock/Service.qml on this head. The lock blanks the panel and the panel drops HPD. Hyprland re-adds the output lit, and the rebuild's motion re-arms the 5s blank. The blank then turns the panel off again, so it drops HPD again. The loop goes on with one panel instead of all of them, and every cycle still re-sends the dmabuf feedback that the description blames for the GTK4 crashes. If the rebuild delivers no motion, nothing re-arms the spent blank timer and the returning panel stays lit. #13129 works one layer down: it enables amdgpu's HDMI HPD debounce, so the output is never removed and re-added and nothing relights. The hardware in the description (AMD Cezanne, Dell panels on HDMI) is exactly the case it covers. #13129 does not reach non-AMD GPUs or DisplayPort, and nobody affected has confirmed it on their machine yet.

The 10s gate also applies to any screens change, not only one the blank caused. Someone who docks or plugs in a monitor while locked and then moves the mouse gets no wake from the lock for 10s. Clicks and keys still wake. The test only matches the new source text with regular expressions, so it would pass whether or not the gate stopped anything. The branch also conflicts with quattro in shell/plugins/lock/Service.qml. There, onScreensChanged now clears displaysBlank, and the blank state tracks per-monitor DPMS, so resolving the conflict needs care.

The other open fixes aimed at this cluster are #8896, #8581, #9152 and #10130. Like this one, they all act on the lock or idle service after the output has already come back.

The bug label comes from an earlier pass where two models classified it the same way; the second was deepseek-v4p1-flash. The second opinion here, Codex Medium, was given this pull request and its competitors without my conclusion. It also picked #13129 for AMD HDMI and traced the same continuing cycle. Since it can read this session's working files, its agreement is not guaranteed to be independent. It separately raised the stays-lit case when no motion arrives and the docking case above.

Waiting on the maintainer to choose between this and #13129.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants