bug: Space key events from uinput virtual keyboards are swallowed in Claude Code terminal
Description
Claude Code's terminal input handling drops space key events injected by
uinput virtual keyboards (e.g. dotool). Other characters (letters, digits,
punctuation, umlauts) are received correctly — only spaces are lost.
The same virtual keyboard input works correctly in:
- Alacritty (same terminal emulator, without Claude Code running)
- Chrome / Firefox
- KDE/Qt applications
Steps to reproduce
- Install dotool:
pacman -S dotool - Start Claude Code in Alacritty
- Focus the Claude Code input prompt
- In another terminal, run:
``bash``
sleep 3 && echo 'type Hello World Test 1 2 3' | dotool
- Switch to Claude Code within 3 seconds
Expected: Hello World Test 1 2 3 appears in the prompt
Actual: HelloWorldTest123 or Hello WorldTest123 (first few spaces may work, then all spaces are dropped)
Analysis
- dotool creates a uinput virtual keyboard device (
/dev/input/eventXXX) - It sends
KEY_SPACEpress/release events via uinput (keycode 57) - The events reach the Wayland compositor (confirmed working in other apps)
- Claude Code's terminal process appears to filter/consume the space events
The timing pattern is consistent: the first ~140ms of typing includes spaces,
then they stop appearing. This suggests something in Claude Code's process
begins intercepting the virtual keyboard device shortly after it is created.
Clipboard-based input (wl-copy + Ctrl+V) works correctly as a workaround.
Environment
- OS: Arch Linux / CachyOS (rolling, kernel 6.19.10)
- Wayland compositor: Hyprland 0.54.3 (also reproduces on KDE KWin 6.6.3)
- Terminal: Alacritty
- Claude Code: 2.1.86+
- dotool: 1.6
- Keyboard layout: German (de), XKB_DEFAULT_LAYOUT=de
---
This issue was analyzed and filed with the help of Claude Opus 4.6 running inside Claude Code itself. The debugging session involved intercepting dotool's stdin via a wrapper script, testing across multiple output backends (dotool, wtype, clipboard), and isolating the issue to Claude Code's terminal by comparing behavior across Alacritty (with/without Claude Code), Chrome, and other applications.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗