You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Text input does not work in terminal emulators (GNOME Terminal, xterm) - only ^M visible
Description
QSpeak transcription works correctly in GUI applications (e.g., VS Code, text editors), but fails to input any text in terminal emulators. After speaking and having QSpeak process the transcription, no text appears in the terminal. However, when pressing Enter afterward, the terminal displays ^M (carriage return character), indicating that some input events are being received but not the actual text content.
Press F6 to stop recording and trigger transcription
Observe that no text appears in the terminal
Press Enter
Observe ^M character appears
Expected Behavior
Transcribed text should appear in the terminal at the cursor position, the same way it works in GUI applications like VS Code.
Actual Behavior
No visible text is typed into the terminal
Only ^M (carriage return, \r) appears after pressing Enter
This suggests keypress events may be partially reaching the terminal but the actual character input is being rejected or lost
Additional Testing Performed
xdotool works manually
Running xdotool type --delay 50 "hello from xdotool" in a separate window successfully types text into GNOME Terminal when it has focus. This confirms:
xdotool itself works with the terminal
The terminal accepts synthetic keyboard input via XTEST
The issue is specific to how QSpeak sends input
GUI applications work fine
QSpeak correctly inputs transcribed text into:
Visual Studio Code
Other GUI text editors
Possible Causes
Based on research, this could be related to:
enigo library behavior: QSpeak likely uses the enigo Rust crate for input simulation, which uses libxdo (xdotool's library) on Linux. There may be differences in how enigo sends events compared to direct xdotool usage.
Line ending handling: The ^M character suggests carriage returns (\r) are being sent but not translated properly by the terminal.
Suggested Solutions
Add a clipboard-paste mode: Instead of simulating keystrokes, copy transcribed text to clipboard and simulate Ctrl+Shift+V for terminal windows. This is more reliable for terminals.
Use XTEST API: Ensure enigo is using the XTEST extension (typing to active window) rather than XSendEvent (sending to specific window ID).
Clear modifiers: Call xdo_clear_active_modifiers before typing to prevent modifier key interference.
Detect terminal windows: Optionally detect when the focused window is a terminal emulator and use an alternative input method.
Text input does not work in terminal emulators (GNOME Terminal, xterm) - only
^MvisibleDescription
QSpeak transcription works correctly in GUI applications (e.g., VS Code, text editors), but fails to input any text in terminal emulators. After speaking and having QSpeak process the transcription, no text appears in the terminal. However, when pressing Enter afterward, the terminal displays
^M(carriage return character), indicating that some input events are being received but not the actual text content.Environment
echo $XDG_SESSION_TYPEreturnsx11)gnome-terminal-)xterm-256color/usr/bin/xdotool)Steps to Reproduce
^Mcharacter appearsExpected Behavior
Transcribed text should appear in the terminal at the cursor position, the same way it works in GUI applications like VS Code.
Actual Behavior
^M(carriage return,\r) appears after pressing EnterAdditional Testing Performed
xdotool works manually
Running
xdotool type --delay 50 "hello from xdotool"in a separate window successfully types text into GNOME Terminal when it has focus. This confirms:GUI applications work fine
QSpeak correctly inputs transcribed text into:
Possible Causes
Based on research, this could be related to:
enigo library behavior: QSpeak likely uses the
enigoRust crate for input simulation, which useslibxdo(xdotool's library) on Linux. There may be differences in how enigo sends events compared to direct xdotool usage.Missing
--clearmodifiersequivalent: The enigo library may not be clearing active modifiers before typing, which can cause issues (see [enigo issue #83](Clear modifiers before typing enigo-rs/enigo#83)).Window targeting: If enigo is sending events to a specific window ID rather than using XTEST to type to the active window, terminals may reject these events due to the
send_eventflag (see [xdotool SENDEVENT NOTES](https://manpages.ubuntu.com/manpages/trusty/man1/xdotool.1.html#sendevent%20notes)).Line ending handling: The
^Mcharacter suggests carriage returns (\r) are being sent but not translated properly by the terminal.Suggested Solutions
Add a clipboard-paste mode: Instead of simulating keystrokes, copy transcribed text to clipboard and simulate
Ctrl+Shift+Vfor terminal windows. This is more reliable for terminals.Use XTEST API: Ensure enigo is using the XTEST extension (typing to active window) rather than XSendEvent (sending to specific window ID).
Clear modifiers: Call
xdo_clear_active_modifiersbefore typing to prevent modifier key interference.Detect terminal windows: Optionally detect when the focused window is a terminal emulator and use an alternative input method.
Related Issues / References
Workaround Requests
Would it be possible to add an option for "clipboard paste mode" that:
Ctrl+Shift+V(standard terminal paste shortcut)This would provide a reliable workaround for terminal users.
Thank you for this great tool! Happy to provide any additional debugging information needed.