Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: Use kdotool for Wayland terminal detection
Toby Foxd92265f7c76f
diff --git a/README.md b/README.mdindex 37f7f50e6..f64f38e75 100644--- a/README.md+++ b/README.md@@ -179,6 +179,9 @@ sudo pacman -S wtype# Alternative: ydotool (requires uinput permissions)sudo apt install ydotool # or equivalent for your distro++# On KDE Wayland you will additionally need `kdotool` to detect if a terminal is focused for automatically pasting with Ctrl+Shift+V instead of Ctrl+V. Automatic terminal detection on non-KDE Wayland is not yet supported.+sudo apt install kdotool # or equivalent for your distro```> ℹ️ **Note**: OpenWhispr automatically detects your display server (X11 vs Wayland) and uses the appropriate paste tool. If no paste tool is installed, text will still be copied to the clipboard - you'll just need to paste manually with Ctrl+V.diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.jsindex d9b58b2ad..fb3fdd39d 100644--- a/src/helpers/clipboard.js+++ b/src/helpers/clipboard.js@@ -170,7 +170,27 @@ class ClipboardManager {// Detect if the focused window is a terminal emulator// Terminals use Ctrl+Shift+V for paste (since Ctrl+V/C are used for process control)const isTerminal = () => {+ // Common terminal emulator class names+ const terminalClasses = [+ "konsole",+ "gnome-terminal",+ "terminal",+ "kitty",+ "alacritty",+ "terminator",+ "xterm",+ "urxvt",+ "rxvt",+ "tilix",+ "terminology",+ "wezterm",+ "foot",+ "st",+ "yakuake",+ ];+try {+ // Try xdotool (works on X11 and XWayland)if (commandExists("xdotool")) {const result = spawnSync("xdotool", ["getactivewindow",@@ -178,33 +198,36 @@ class ClipboardManager {]);if (result.status === 0) {const className = result.stdout.toString().toLowerCase().trim();- // Common terminal emulator class names- const terminalClasses = [- "konsole",- "gnome-terminal",- "terminal",- "kitty",- "alacritty",- "terminator",- "xterm",- "urxvt",- "rxvt",- "tilix",- "terminology",- "wezterm",- "foot",- "st",- "yakuake",- ];const isTerminalWindow = terminalClasses.some((term) =>className.includes(term));if (isTerminalWindow) {- this.safeLog(`🖥️ Terminal detected: ${className}`);+ this.safeLog(`🖥️ Terminal detected via xdotool: ${className}`);}return isTerminalWindow;}}++ // Try kdotool for KDE Wayland (if available)+ if (commandExists("kdotool")) {+ // First get the active window ID+ const windowIdResult = spawnSync("kdotool", ["getactivewindow"]);+ if (windowIdResult.status === 0) {+ const windowId = windowIdResult.stdout.toString().trim();+ // Then get the window class name+ const classResult = spawnSync("kdotool", ["getwindowclassname", windowId]);+ if (classResult.status === 0) {+ const className = classResult.stdout.toString().toLowerCase().trim();+ const isTerminalWindow = terminalClasses.some((term) =>+ className.includes(term)+ );+ if (isTerminalWindow) {+ this.safeLog(`🖥️ Terminal detected via kdotool: ${className}`);+ }+ return isTerminalWindow;+ }+ }+ }} catch (error) {// Silent fallback - if detection fails, assume non-terminal}