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(linux): use uinput before portal on GNOME Wayland (#494)
Gabriel Steinf6510cafeb46
diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.jsindex c436d76f2..03b3f8cae 100644--- a/src/helpers/clipboard.js+++ b/src/helpers/clipboard.js@@ -134,8 +134,7 @@ class ClipboardManager {if (this.commandExists("wl-copy")) {try {- const isHyprland = !!process.env.HYPRLAND_INSTANCE_SIGNATURE;- const result = spawnSync("wl-copy", ["--", text], { timeout: isHyprland ? 50 : 1 });+ const result = spawnSync("wl-copy", ["--", text], { timeout: 50 });if (result.status === 0) {clipboard.writeText(text);return;@@ -1146,11 +1145,6 @@ class ClipboardManager {});if (isWayland) {- // On KDE with XWayland (ozone-platform-hint: x11), portal paste works- // because clipboard and input are both on X11. uinput causes a clipboard- // desync (X11 clipboard vs Wayland input) so portal is preferred.- // On GNOME, Mutter doesn't reliably route uinput to native Wayland- // windows (issue #292), so portal is tried first there too.const tryUinputPaste = async () => {const args = ["--uinput"];if (earlyIsTerminal) args.push("--terminal");@@ -1164,7 +1158,7 @@ class ClipboardManager {restoreClipboard();};- if ((isGnome || isKde) && linuxFastPaste && !this.portalDenied) {+ const tryPortalPaste = async () => {const MAX_PORTAL_RETRIES = 3;for (let attempt = 0; attempt < MAX_PORTAL_RETRIES; attempt++) {try {@@ -1176,7 +1170,7 @@ class ClipboardManager {"clipboard");restoreClipboard();- return "portal";+ return true;} catch (portalError) {if (portalError?.message === "portal-dismissed") {debugLogger.warn(@@ -1195,21 +1189,49 @@ class ClipboardManager {);} else {debugLogger.warn(- "linux-fast-paste --portal failed, falling back to uinput",+ "linux-fast-paste --portal failed, falling back",{ error: portalError?.message },"clipboard");}- break;+ return false;}}- }+ return false;+ };- try {- await tryUinputPaste();- return "uinput";- } catch (uinputError) {- debugLogger.warn("uinput paste failed", { error: uinputError?.message }, "clipboard");+ // KDE with XWayland: portal first because clipboard and input are both+ // on X11. uinput causes clipboard desync (X11 clipboard vs Wayland input).+ // GNOME: uinput first because the portal often times out or shows a+ // confusing permission dialog, causing a 10s+ delay (issue #494).+ if (isKde && linuxFastPaste && !this.portalDenied) {+ if (await tryPortalPaste()) return "portal";+ try {+ await tryUinputPaste();+ return "uinput";+ } catch (uinputError) {+ debugLogger.warn("uinput paste failed", { error: uinputError?.message }, "clipboard");+ }+ } else if (isGnome && linuxFastPaste) {+ try {+ await tryUinputPaste();+ return "uinput";+ } catch (uinputError) {+ debugLogger.warn(+ "uinput paste failed on GNOME, trying portal",+ { error: uinputError?.message },+ "clipboard"+ );+ }+ if (!this.portalDenied && (await tryPortalPaste())) return "portal";+ } else {+ // Other compositors (wlroots, etc.): try uinput only+ try {+ await tryUinputPaste();+ return "uinput";+ } catch (uinputError) {+ debugLogger.warn("uinput paste failed", { error: uinputError?.message }, "clipboard");+ }}// XTest/XWayland fallback: works for XWayland apps on any Wayland compositor