Repository navigation
Exit the screensaver on mouse click - #16519
joshuaswarren wants to merge 4 commits into
Conversation
[Low impact] The PR appears safe to merge, with non-blocking test concerns. FindingsSummaryThe PR enables terminal mouse reports so clicks reach the screensaver’s existing input exit path.
Reviews (4) · Last reviewed commit: "test: keep screensaver click regression ..." · Reviewed by Greptile |
The screensaver exits on any byte from the terminal, so a key press ends it. A mouse click produces no bytes: the terminal never reports mouse input to the shell unless the program asks for it. Ask for button-press reporting at startup and stop asking in the exit path, so a click now delivers input and ends the screensaver the same way a key press does.
6139ed1 to
0dc6919
Compare
| @@ -0,0 +1,156 @@ | |||
| #!/bin/bash | |||
|
|
|||
| source "$(dirname "$0")/base-test.sh" | |||
There was a problem hiding this comment.
Required Bash options are missing
The new test omits set -euo pipefail, which the contributor guide requires before sourcing base-test.sh. Without these options, failed setup commands can leave the test running with incomplete files. Add the required line before merging.
| source "$(dirname "$0")/base-test.sh" | |
| set -euo pipefail | |
| source "$(dirname "$0")/base-test.sh" |
File Used: docs/testing.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| source "$(dirname "$0")/base-test.sh" | ||
|
|
||
| # Keep the real read/exit path; desktop commands must not affect this session. | ||
| hyprctl() { return 0; } |
There was a problem hiding this comment.
Test passes through focus loss
The new hyprctl stub returns no window data, so screensaver_in_focus fails whenever read fails. The script then exits through focus loss and prints the same disable bytes the test expects. This lets the test pass even if input no longer exits the screensaver. Have the stub report the screensaver as focused so only the supplied input can trigger a successful exit.
|
Thanks for working on this. #16800, now merged, replaced the terminal screensaver with a native Wayland overlay that dismisses itself on any key, click, scroll or mouse movement, so this fix to the terminal version is no longer needed. Closing in favour of it. |
Problem
A mouse click does nothing while the screensaver runs. Only a key press exits it.
Cause
The screensaver loop waits for a byte from the terminal:
A key press produces a byte. A click produces none. Terminals only report mouse input when a program asks for it, so every click was dropped.
Change
Ask for button-press reports at startup. Stop asking in the exit path:
A click now delivers input bytes. The existing
readexits the screensaver, same as a key press. Mode 1000 reports presses only, so cursor motion alone cannot exit. Mode 1006 is the modern encoding, safe at large coordinates. This is standard xterm mouse reporting. It works in foot, Alacritty, Ghostty and Kitty, every terminal the launcher supports.Verification
On Apple Silicon hardware, with the patched script installed:
A live click was not tested end to end. The host runs headless over SSH, and no tool there could deliver a real pointer click to the compositor. With reporting on, a click takes the same input path as a key press. The last step still needs one manual check on a desktop with a mouse. The change is two lines and reverts by removing them.