Fix ydotool virtual input device leak (#7)#8
Merged
Conversation
…ak (#7) Each ydotool invocation without ydotoold creates a kernel virtual input device that persists until reboot. Add auto-detection fallback chain (wtype → ydotool+daemon → xdotool → ydotool with warning) configurable via TALKTYPE_TYPE_CMD, matching the existing ffmpeg/pw-record pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a virtual input device leak issue with ydotool by implementing a typing tool fallback chain and adding proper daemon detection. The changes introduce flexibility in choosing typing tools while warning users about the device leak issue when using bare ydotool without its daemon.
Changes:
- Implements automatic typing tool selection with fallback chain: wtype (Wayland) → ydotool+daemon → xdotool (X11) → ydotool with warning
- Adds
TALKTYPE_TYPE_CMDconfiguration variable for manual tool override - Includes one-time-per-session warning system for bare ydotool usage
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| talktype | Adds type_text() function with auto-detection logic and warn_ydotool_no_daemon() for user warnings; updates check_deps() to handle multiple typing tools |
| test/talktype.bats | Adds tests for wtype preference and TYPE_CMD override; updates existing tests to set WAYLAND_DISPLAY and TYPE_CMD; updates dependency test for multiple tools |
| test/mocks/wtype | New mock for wtype typing tool that logs invocations |
| test/mocks/xdotool | New mock for xdotool typing tool that logs invocations |
| README.md | Documents new typing tool requirements and configuration options; updates architecture diagram |
| CLAUDE.md | New developer documentation file describing project architecture, testing, and conventions |
| Makefile | Adds wtype to system dependencies |
| .github/workflows/ci.yml | Adds wtype to CI test dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…dge cases - Add pgrep mock for deterministic tests (default: no ydotoold running) - Add test for ydotool+daemon detection path - Add test for bare ydotool warning (once-per-session) - Error explicitly if auto-detection finds no typing tool - Update line counts in CLAUDE.md and README.md - Update architecture description in CLAUDE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
wtype can be installed but fail at runtime if the compositor doesn't support virtual-keyboard-unstable-v1 (e.g. GNOME). Change auto mode to actually try each tool and fall through on failure, rather than just checking if the binary exists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bare ydotool without ydotoold leaks kernel input devices that can crash the system. Auto mode now only uses safe tools (wtype, ydotool+daemon, xdotool) and errors with clear instructions if none work. Users can still opt in to bare ydotool via TALKTYPE_TYPE_CMD=ydotool. Also remove Parakeet backend from README (CTC model outputs lowercase without punctuation, not useful for typing). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On GNOME Wayland, wtype fails (no virtual-keyboard protocol) and xdotool fails (X11 events ignored by Wayland apps). Bare ydotool is the only working option. Testing shows ydotool 0.1.8-3build1 cleans up its virtual input devices, so allow it as a last resort with a once-per-session warning about the potential device leak. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xdotool sends X11 key events that Wayland-native apps silently ignore, yet returns exit 0. Only try xdotool on pure X11 sessions (DISPLAY set, WAYLAND_DISPLAY unset) so it doesn't block the ydotool fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
wtype→ydotool+daemon →xdotool→ydotoolwith warning) to avoid leaking kernel virtual input devices when using bare ydotool withoutydotooldtype_text()function with auto-detection, configurable viaTALKTYPE_TYPE_CMD(matches existingffmpeg/pw-recordpattern for recording)Test plan
wtypeinstalled — should use wtype, no device leakTALKTYPE_TYPE_CMD=xdotool— should use xdotool🤖 Generated with Claude Code