Skip to content

fix(injection): release stuck ydotool Ctrl after a timed-out paste - #675

Draft
jatinkrmalik wants to merge 1 commit into
mainfrom
jatin/ydotool-stuck-ctrl-658-2b1a
Draft

fix(injection): release stuck ydotool Ctrl after a timed-out paste#675
jatinkrmalik wants to merge 1 commit into
mainfrom
jatin/ydotool-stuck-ctrl-658-2b1a

Conversation

@jatinkrmalik

Copy link
Copy Markdown
Member

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 with timeout=3. If the client is still running at 3s, Python SIGKILLs it.

ydotoold does 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 TimeoutExpired or CalledProcessError, send a best-effort release:

  • ydotool 1.x: ydotool key 47:0 29:0
  • ydotool 0.1.x: ydotool 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Test update

Checklist

  • My code follows the code style of this project (black, isort)
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests pass locally
  • Pre-commit hooks pass

Additional Notes

Happy-path paste is ~50ms, so the 3s timeout almost never fires. The stuck-Ctrl case needs ydotoold to stop reading after 29:1. Tests cover v1 timeout, 0.1.x process error, and a wedged release path.

Open in Web Open in Cursor 

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
@github-actions github-actions Bot added app Core Python application (src, packaging) tests Test suite changes labels Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Core Python application (src, packaging) tests Test suite changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Ctrl shortcuts broke system-wide until relogin

1 participant