fix(injection): release stuck ydotool Ctrl after a timed-out paste - #675
Draft
jatinkrmalik wants to merge 1 commit into
Draft
fix(injection): release stuck ydotool Ctrl after a timed-out paste#675jatinkrmalik wants to merge 1 commit into
jatinkrmalik wants to merge 1 commit into
Conversation
subprocess.run(..., timeout=3) SIGKILLs the ydotool client. ydotoold keeps any keys it already applied, so virtual Left Ctrl can stay held until logout. Send a best-effort V-up/Ctrl-up (or a legacy ctrl tap) after paste failure. Fixes #658
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.
Description
On Wayland, ydotool paste is clipboard + a synthetic Ctrl+V. For ydotool 1.x that is four evdev events (
29:1 47:1 47:0 29:0). We run that withtimeout=3. If the client is still running at 3s, Python SIGKILLs it.ydotoolddoes not track pressed keys and does not release anything when the client dies. If Left Ctrl (29:1) already hit uinput, it stays down on that virtual device until logout. That is the system-wide "Ctrl+A / Ctrl+V stopped working" report in #658.After a paste
TimeoutExpiredorCalledProcessError, send a best-effort release:ydotool key 47:0 29:0ydotool key ctrl(a tap; the up half should clear a stuck Ctrl)Releasing an already-up key is a no-op. If the daemon is still wedged, the follow-up can also time out; that is swallowed so paste still returns False.
This does not fix a fully dead
ydotoold. It covers the case hopsayer described: daemon applied Ctrl-down, then the client got killed before Ctrl-up.Related Issue
Fixes #658
Type of Change
Checklist
Additional Notes
Happy-path paste is ~50ms, so the 3s timeout almost never fires. The stuck-Ctrl case needs
ydotooldto stop reading after29:1. Tests cover v1 timeout, 0.1.x process error, and a wedged release path.