Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(linux): hold back the paste until wl-copy wrote the Wayland selections on niri, wlroots and Hyprland (#2643)

void021d8eee55fd
diff --git a/CLAUDE.md b/CLAUDE.md
index 2ca25312d..bc2d1a0e9 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -63,6 +63,7 @@ OpenWhispr is an Electron-based desktop dictation application that uses whisper.
- macOS: AppleScript-based paste with accessibility permission check
- Windows: PowerShell SendKeys with nircmd.exe fallback
- Linux: compositor-aware Wayland paste (Hyprland sendshortcut, wlroots wtype, GNOME/KDE portal keysyms) with native uinput/XTest and system-tool fallbacks. KDE's portal paste sends Shift+Insert to every window but Warp, which binds paste to Ctrl+Shift+V only: KWin resolves keysyms in the active layout only, so a Ctrl+V on a non-Latin layout arrives as Ctrl alone (#2055). The app runs on XWayland, which the compositor won't let read a native Wayland app's clipboard while a Wayland window is focused, so `_saveClipboard` falls back to `wl-paste --type text` when Electron reads nothing; otherwise the restore would wipe the user's clipboard
+ - Linux: wlroots, Hyprland and niri (xwayland-satellite) hand XWayland's clipboard to a native Wayland app only while an X11 window has focus; KWin, Mutter and COSMIC do it themselves. There (`requiresWlCopy` in `linuxSession.js`; a leftover `SWAYSOCK` or Hyprland signature under another desktop doesn't count) the transcript reaches Wayland apps only through `wl-copy`, so `_pasteText` pastes only when wl-copy wrote both the Wayland clipboard (`_writeClipboardWayland`) and the primary selection that terminals paste on Shift+Insert (`_writePrimarySelection`). `wl-copy --primary` goes through data-control, which still takes a primary selection under niri `disable-primary` (checked on niri 26.04) and Hyprland `middle_click_paste = false` (its data-control code never reads that option). Otherwise it injects nothing and returns `reason: "wl-copy-missing"` (not installed) or `"wl-copy-failed"` (e.g. killed by its 200 ms timeout): the renderer shows the dictation-error pill (Retry writes and pastes the kept text again, never records), a selection edit reports `code: "wl_copy_missing"`/`"wl_copy_failed"`, and the paste-tools card and Settings → Wayland Paste Setup ask for wl-clipboard (#2621). There, a missing `wl-copy` is probed again rather than read from the 30 s command cache, so one installed after a held-back paste counts at once
- Linux COSMIC: paste reads the focused app from cosmic-comp's `zcosmic_toplevel_info_v1` (`cosmicToplevel.js`, a minimal Wayland wire client, bound at version 1, which still sends app_id and state), never from xdotool, whose XWayland answer goes stale while a native Wayland window has focus. A known terminal is pasted through wtype (Ctrl+Shift+V; Shift+Insert for Konsole); everything else keeps uinput Shift+Insert, since COSMIC gives no PID to spot Electron apps hosting TUIs. Short terminal names (`st`) match whole words only, or every `com.system76.*` app id would read as a terminal
- Linux: before any paste or selection-copy chord, `linux-fast-paste --capabilities --await-modifier-release <ms>` waits for physically held modifiers to be released (XKB state on X11, `EVIOCGKEY` on Wayland; `unknown` without `/dev/input` access pastes as before). A chord injected into held keys arrives as a different shortcut, and a virtual device cannot release another device's key (#2113). Still held after 1.5 s → not pasted, `reason: "modifiers-held"`, and the renderer shows the dictation-error pill with the transcript on the clipboard; a selection edit blocked the same way reports `code: "modifiers_held"` and gets the same pill (the assistant caret paste reports the same code, for logs only). `ydotoold`'s virtual keyboard is ignored, since an interrupted chord can leave its modifier down, and an unreadable key state is logged once per session. The wait runs before `pasteLinux` detects the target window, and a selection copy that had to wait looks the target up again, since focus can move while a key is held: a fresh capture then runs the command on its own (`focus_moved`), and a revalidated session declines as `target_changed`. Retry on a modifiers-held pill pastes the kept transcript again rather than recording again (the macOS/Windows push force-stop pill keeps its record-again Retry, since neither platform waits for held keys), ignores clicks while its paste is pending, and never dismisses a newer pill. `useAudioRecording` keeps the pill in processing until the paste attempt settles (the audio manager settles before the paste starts), but never reports that to main, which drops dictation hotkeys while processing; a paste held back after the next dictation started leaves the transcript on the clipboard without a pill. The helper measures its wait on `CLOCK_MONOTONIC`, since the JS watchdog kills it at timeout + 1 s
- **database.js**: SQLite operations for transcription history
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 0a8f8ce1c..2a3527672 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -1375,6 +1375,7 @@ export default function SettingsPage({
hasYdotool: boolean;
hasYdotoold: boolean;
hasWtype: boolean;
+ hasWlCopy: boolean;
daemonRunning: boolean;
hasService: boolean;
hasUinput: boolean;
@@ -1383,6 +1384,7 @@ export default function SettingsPage({
isKde: boolean;
isWlroots: boolean;
isCosmic: boolean;
+ requiresWlCopy: boolean;
hasXclip: boolean;
hasXsel: boolean;
isNixOS: boolean;
@@ -3824,6 +3826,26 @@ EOF`,
});
}
+ if (ydotoolStatus.requiresWlCopy) {
+ checks.push({
+ key: "hasWlCopy",
+ label: "wl-copy",
+ ok: ydotoolStatus.hasWlCopy,
+ required: true,
+ desc: t("settingsPage.general.waylandPaste.wlCopyDesc"),
+ steps: [
+ {
+ title: t("settingsPage.general.waylandPaste.guide.wlCopy.step1Title"),
+ cmds: getLinuxPasteInstallCommands(t, "wl-clipboard"),
+ },
+ {
+ title: t("settingsPage.general.waylandPaste.guide.wlCopy.step2Title"),
+ cmds: [{ cmd: "which wl-copy" }],
+ },
+ ],
+ });
+ }
+
const allOk = checks.filter((c) => c.required).every((c) => c.ok);
const activeGuide = checks.find((c) => c.key === ydotoolGuideKey);
diff --git a/src/components/ui/PasteToolsInfo.tsx b/src/components/ui/PasteToolsInfo.tsx
index 568e9c39d..eb21cc4e9 100644
--- a/src/components/ui/PasteToolsInfo.tsx
+++ b/src/components/ui/PasteToolsInfo.tsx
@@ -7,6 +7,7 @@ import {
getLinuxPasteInstallCommands,
needsLinuxPasteToolGuidance,
needsWtype,
+ type LinuxPasteTool,
} from "../../utils/linuxPasteTools";
interface PasteToolsInfoProps {
@@ -15,6 +16,22 @@ interface PasteToolsInfoProps {
onCheck: () => void;
}
+function LinuxInstallCommands({ tool }: { tool: LinuxPasteTool }) {
+ const { t } = useTranslation();
+ return (
+ <div className="mt-3 space-y-2 bg-card border border-border p-3 rounded-md font-mono text-xs overflow-x-auto">
+ {getLinuxPasteInstallCommands(t, tool).map(({ label, cmd }) => (
+ <div key={cmd}>
+ <div className="text-muted-foreground">{label}</div>
+ <div dir="ltr" className="text-foreground">
+ {cmd}
+ </div>
+ </div>
+ ))}
+ </div>
+ );
+}
+
export default function PasteToolsInfo({
pasteToolsInfo,
isChecking,
@@ -100,7 +117,9 @@ export default function PasteToolsInfo({
if (needsLinuxPasteToolGuidance(pasteToolsInfo)) {
const isWayland = pasteToolsInfo.isWayland;
+ const wlCopyMissing = !!pasteToolsInfo.wlCopyMissing;
const wtypeMissing = needsWtype(pasteToolsInfo);
+ const needsPasteTool = !pasteToolsInfo.available || wtypeMissing;
const cosmicTerminalsOnly = wtypeMissing && !!pasteToolsInfo.isCosmic;
const recommendedTool = wtypeMissing
? "wtype"
@@ -113,77 +132,88 @@ export default function PasteToolsInfo({
return (
<InfoBox variant="warning" className="space-y-3">
- <div className="flex items-start gap-3">
- <Info className="w-6 h-6 text-warning dark:text-warning flex-shrink-0 mt-0.5" />
- <div className="flex-1">
- <h3 className="font-semibold text-warning dark:text-warning">
- {showInstall
- ? t("pasteToolsInfo.optionalEnableTitle")
- : t("pasteToolsInfo.waylandClipboardTitle")}
- </h3>
-
- {showInstall ? (
- <>
- <p className="text-sm text-warning dark:text-warning mt-1">
- {cosmicTerminalsOnly ? (
- t("pasteToolsInfo.wtypeCosmicTerminalsDescription")
- ) : wtypeMissing ? (
- t("pasteToolsInfo.wtypeFallbackDescription")
- ) : (
- <>
- {t("pasteToolsInfo.installPrefix")}{" "}
- <code dir="ltr" className="bg-warning/20 px-1 rounded font-mono">
- {recommendedTool}
- </code>
- :
- </>
- )}
- </p>
+ {/* wl-clipboard and a paste tool can both be missing; list both, so one
+ Re-check doesn't uncover the other. */}
+ {wlCopyMissing && (
+ <div className="flex items-start gap-3">
+ <Info className="w-6 h-6 text-warning dark:text-warning flex-shrink-0 mt-0.5" />
+ <div className="flex-1">
+ <h3 className="font-semibold text-warning dark:text-warning">
+ {t("pasteToolsInfo.wlClipboardTitle")}
+ </h3>
+ <p className="text-sm text-warning dark:text-warning mt-1">
+ {t("pasteToolsInfo.wlClipboardDescription")}
+ </p>
+ <LinuxInstallCommands tool="wl-clipboard" />
+ </div>
+ </div>
+ )}
- <div className="mt-3 space-y-2 bg-card border border-border p-3 rounded-md font-mono text-xs overflow-x-auto">
- {getLinuxPasteInstallCommands(t, recommendedTool).map(({ label, cmd }) => (
- <div key={cmd}>
- <div className="text-muted-foreground">{label}</div>
- <div dir="ltr" className="text-foreground">
- {cmd}
- </div>
- </div>
- ))}
- </div>
-
- {isWayland && recommendedTool === "wtype" && (
- <p className="text-sm text-warning dark:text-warning mt-3">
- {t("pasteToolsInfo.noteXwaylandAlso")}
- </p>
- )}
+ {needsPasteTool && (
+ <div className="flex items-start gap-3">
+ <Info className="w-6 h-6 text-warning dark:text-warning flex-shrink-0 mt-0.5" />
+ <div className="flex-1">
+ <h3 className="font-semibold text-warning dark:text-warning">
+ {showInstall
+ ? t("pasteToolsInfo.optionalEnableTitle")
+ : t("pasteToolsInfo.waylandClipboardTitle")}
+ </h3>
- {isWayland && recommendedTool === "xdotool" && (
- <p className="text-sm text-warning dark:text-warning mt-3">
- {t("pasteToolsInfo.noteXwaylandOnly")}
+ {showInstall ? (
+ <>
+ <p className="text-sm text-warning dark:text-warning mt-1">
+ {cosmicTerminalsOnly ? (
+ t("pasteToolsInfo.wtypeCosmicTerminalsDescription")
+ ) : wtypeMissing ? (
+ t("pasteToolsInfo.wtypeFallbackDescription")
+ ) : (
+ <>
+ {t("pasteToolsInfo.installPrefix")}{" "}
+ <code dir="ltr" className="bg-warning/20 px-1 rounded font-mono">
+ {recommendedTool}
+ </code>
+ :
+ </>
+ )}
</p>
- )}
- </>
- ) : (
- <p className="text-sm text-warning dark:text-warning mt-1">
- {t("pasteToolsInfo.waylandClipboardDescription")}{" "}
- <kbd dir="ltr" className="bg-warning/20 px-1 rounded text-xs">
- Ctrl+V
- </kbd>
- .
- </p>
- )}
-
- {showInstall && !cosmicTerminalsOnly && (
- <p className="text-sm text-warning dark:text-warning mt-3">
- {t("pasteToolsInfo.withoutToolPrefix")}{" "}
- <kbd dir="ltr" className="bg-warning/20 px-1 rounded text-xs">
- Ctrl+V
- </kbd>
- .
- </p>
- )}
+
+ <LinuxInstallCommands tool={recommendedTool} />
+
+ {isWayland && recommendedTool === "wtype" && (
+ <p className="text-sm text-warning dark:text-warning mt-3">
+ {t("pasteToolsInfo.noteXwaylandAlso")}
+ </p>
+ )}
+
+ {isWayland && recommendedTool === "xdotool" && (
+ <p className="text-sm text-warning dark:text-warning mt-3">
+ {t("pasteToolsInfo.noteXwaylandOnly")}
+ </p>
+ )}
+ </>
+ ) : (
+ <p className="text-sm text-warning dark:text-warning mt-1">
+ {t("pasteToolsInfo.waylandClipboardDescription")}{" "}
+ <kbd dir="ltr" className="bg-warning/20 px-1 rounded text-xs">
+ Ctrl+V
+ </kbd>
+ .
+ </p>
+ )}
+
+ {/* Without wl-copy, a manual Ctrl+V in a Wayland app pastes stale text too. */}
+ {showInstall && !cosmicTerminalsOnly && !wlCopyMissing && (
+ <p className="text-sm text-warning dark:text-warning mt-3">
+ {t("pasteToolsInfo.withoutToolPrefix")}{" "}
+ <kbd dir="ltr" className="bg-warning/20 px-1 rounded text-xs">
+ Ctrl+V
+ </kbd>
+ .
+ </p>
+ )}
+ </div>
</div>
- </div>
+ )}
<div className="flex justify-end">
<Button variant="outline" size="sm" onClick={onCheck} disabled={isChecking}>
diff --git a/src/helpers/assistantResponseDelivery.ts b/src/helpers/assistantResponseDelivery.ts
index 849da78bb..3894e87e6 100644
--- a/src/helpers/assistantResponseDelivery.ts
+++ b/src/helpers/assistantResponseDelivery.ts
@@ -17,7 +17,7 @@ interface AssistantResponseDeliveryApi {
text: string,
options?: { restoreClipboard?: boolean; allowClipboardFallback?: boolean }
) => Promise<{ success: boolean }>;
- writeClipboard?: (text: string) => Promise<{ success: boolean }>;
+ writeClipboard?: (text: string) => Promise<{ success: boolean; xwaylandOnly?: boolean }>;
}
interface ClipboardWriter {
@@ -61,6 +61,9 @@ async function copyAssistantResponse(
): Promise<boolean> {
try {
const result = await electronAPI?.writeClipboard?.(content);
+ // The user's app still has focus, so it can't read this copy (#2621); the
+ // renderer's clipboard would land in the same place.
+ if (result?.xwaylandOnly) return false;
if (result?.success === true) return true;
} catch {}
diff --git a/src/helpers/clipboard.js b/src/helpers/clipboard.js
index bb65edfc1..8ad3a8ecb 100644
--- a/src/helpers/clipboard.js
+++ b/src/helpers/clipboard.js
@@ -85,6 +85,26 @@ function writeClipboardInRenderer(webContents, text) {
return webContents.executeJavaScript(`navigator.clipboard.writeText(${escaped})`);
}
+// wl-copy exits only once the compositor has taken the selection, a round trip a
+// loaded or cold system can stretch past 50 ms. Where wl-copy is required (#2621), a
+// write killed early holds the paste back, so it gets the other clipboard tools' 200 ms.
+const WL_COPY_TIMEOUT_MS = 200;
+
+// Linux refuses a single argument of 128 KiB or more (MAX_ARG_STRLEN). Reading stdin
+// costs wl-copy a temp file and a `cat`, so only text that long goes that way, typed so
+// wl-copy doesn't run xdg-mime to sniff it.
+const MAX_ARG_BYTES = 128 * 1024;
+
+function spawnWlCopy(flags, text) {
+ if (Buffer.byteLength(text) < MAX_ARG_BYTES) {
+ return spawnSync("wl-copy", [...flags, "--", text], { timeout: WL_COPY_TIMEOUT_MS });
+ }
+ return spawnSync("wl-copy", [...flags, "--type", "text/plain"], {
+ input: text,
+ timeout: WL_COPY_TIMEOUT_MS,
+ });
+}
+
class ClipboardManager {
constructor() {
this.accessibilityCache = { value: null, expiresAt: 0 };
@@ -123,6 +143,21 @@ class ClipboardManager {
return isWayland;
}
+ // Where wl-copy is required, a missing one holds back every paste, so its
+ // absence is probed again there instead of read from the cache: a wl-copy
+ // installed after a held-back paste is used by the next one.
+ _wlCopyExists() {
+ if (
+ this.commandAvailabilityCache.get("wl-copy")?.exists === false &&
+ getLinuxSessionInfo().requiresWlCopy
+ ) {
+ this.commandAvailabilityCache.delete("wl-copy");
+ }
+ return this.commandExists("wl-copy");
+ }
+
+ // True when wl-copy wrote the Wayland clipboard; every other path only reaches
+ // XWayland's.
_writeClipboardWayland(text, webContents) {
const { isKde } = getLinuxSessionInfo();
@@ -137,7 +172,7 @@ class ClipboardManager {
});
if (result.status === 0) {
clipboard.writeText(text);
- return;
+ return false;
}
} catch {}
}
@@ -149,21 +184,21 @@ class ClipboardManager {
});
if (result.status === 0) {
clipboard.writeText(text);
- return;
+ return false;
}
} catch {}
}
// Last resort: Electron's clipboard.writeText should work on XWayland
clipboard.writeText(text);
- return;
+ return false;
}
- if (this.commandExists("wl-copy")) {
+ if (this._wlCopyExists()) {
try {
- const result = spawnSync("wl-copy", ["--", text], { timeout: 50 });
+ const result = spawnWlCopy([], text);
if (result.status === 0) {
clipboard.writeText(text);
- return;
+ return true;
}
} catch {}
}
@@ -173,22 +208,24 @@ class ClipboardManager {
}
clipboard.writeText(text);
+ return false;
}
// PRIMARY selection (X11's "highlight to copy") is what terminals like alacritty,
// foot, konsole, xterm, and st bind Shift+Insert to. Mirror the transcription
// there so Shift+Insert pastes reliably regardless of which selection the
// terminal uses. Falls through wl-copy → xclip → xsel → Electron's selection
- // target so we cover Wayland, X11, and XWayland setups.
+ // target so we cover Wayland, X11, and XWayland setups. True when wl-copy wrote
+ // the Wayland primary selection.
_writePrimarySelection(text) {
- if (process.platform !== "linux") return;
+ if (process.platform !== "linux") return false;
const { isWayland } = getLinuxSessionInfo();
if (isWayland && this.commandExists("wl-copy")) {
try {
- const result = spawnSync("wl-copy", ["--primary", "--", text], { timeout: 50 });
- if (result.status === 0) return;
+ const result = spawnWlCopy(["--primary"], text);
+ if (result.status === 0) return true;
} catch {}
}
@@ -198,7 +235,7 @@ class ClipboardManager {
input: text,
timeout: 200,
});
- if (result.status === 0) return;
+ if (result.status === 0) return false;
} catch {}
}
@@ -208,13 +245,14 @@ class ClipboardManager {
input: text,
timeout: 200,
});
- if (result.status === 0) return;
+ if (result.status === 0) return false;
} catch {}
}
try {
clipboard.writeText(text, "selection");
} catch {}
+ return false;
}
_readPrimarySelection() {
@@ -976,13 +1014,16 @@ class ClipboardManager {
this.safeLog("💾 Saved original clipboard:", originalClipboard.type);
}
+ // Apps paste the clipboard; terminals given Shift+Insert (niri always sends it)
+ // paste the primary selection.
+ const waylandWrites = { clipboard: false, primary: false };
if (platform === "linux") {
if (this._isWayland()) {
- this._writeClipboardWayland(text, webContents);
+ waylandWrites.clipboard = this._writeClipboardWayland(text, webContents);
} else {
clipboard.writeText(text);
}
- this._writePrimarySelection(text);
+ waylandWrites.primary = this._writePrimarySelection(text);
} else {
clipboard.writeText(text);
}
@@ -1038,6 +1079,19 @@ class ClipboardManager {
expectedClipboardText: text,
targetWindow: options.targetWindow,
});
+ } else if (
+ getLinuxSessionInfo().requiresWlCopy &&
+ !(waylandWrites.clipboard && waylandWrites.primary)
+ ) {
+ // Wayland apps here read only what wl-copy wrote: a selection it didn't write
+ // is stale, and a chord could paste it. The text stays unrestored.
+ const reason = this.commandExists("wl-copy") ? "wl-copy-failed" : "wl-copy-missing";
+ debugLogger.warn(
+ "Wayland selections not written, leaving the text unpasted",
+ { reason, written: waylandWrites },
+ "clipboard"
+ );
+ pasteResult = { pasted: false, reason, restoreComplete: Promise.resolve() };
} else {
pasteResult = await this.pasteLinux(originalClipboard, {
...options,
@@ -2355,12 +2409,17 @@ Would you like to open System Settings now?`;
return clipboard.readText();
}
+ // `xwaylandOnly`: where wl-copy is required (#2621), a write it didn't make reaches
+ // native Wayland apps only while an OpenWhispr window has focus.
async writeClipboard(text, webContents = null) {
if (process.platform === "linux" && this._isWayland()) {
- this._writeClipboardWayland(text, webContents);
- } else {
- clipboard.writeText(text);
+ const wroteWayland = this._writeClipboardWayland(text, webContents);
+ return {
+ success: true,
+ xwaylandOnly: !wroteWayland && getLinuxSessionInfo().requiresWlCopy,
+ };
}
+ clipboard.writeText(text);
return { success: true };
}
@@ -2390,8 +2449,16 @@ Would you like to open System Settings now?`;
};
}
- const { isWayland, xwaylandAvailable, isGnome, isKde, isWlroots, isHyprland, isCosmic } =
- getLinuxSessionInfo();
+ const {
+ isWayland,
+ xwaylandAvailable,
+ isGnome,
+ isKde,
+ isWlroots,
+ isHyprland,
+ isCosmic,
+ requiresWlCopy,
+ } = getLinuxSessionInfo();
const linuxFastPaste = this.resolveLinuxFastPasteBinary();
const hasNativeBinary = !!linuxFastPaste;
let portalKeysymAvailable = false;
@@ -2472,6 +2539,7 @@ Would you like to open System Settings now?`;
hasWtype,
isWlroots,
isCosmic,
+ wlCopyMissing: requiresWlCopy && !this._wlCopyExists(),
tools,
recommendedInstall,
};
diff --git a/src/helpers/ensureYdotool.js b/src/helpers/ensureYdotool.js
index aaacd3c51..84141924d 100644
--- a/src/helpers/ensureYdotool.js
+++ b/src/helpers/ensureYdotool.js
@@ -193,7 +193,7 @@ function getYdotoolStatus() {
const hasUinput = isUinputAccessible();
const hasUdevRule = udevRuleExists();
const hasGroup = userInInputGroup();
- const { isWayland, isKde, isWlroots, isCosmic } = getLinuxSessionInfo();
+ const { isWayland, isKde, isWlroots, isCosmic, requiresWlCopy } = getLinuxSessionInfo();
return {
isLinux: process.platform === "linux",
@@ -201,9 +201,11 @@ function getYdotoolStatus() {
isKde,
isWlroots,
isCosmic,
+ requiresWlCopy,
hasYdotool,
hasYdotoold,
hasWtype,
+ hasWlCopy: requiresWlCopy && commandExists("wl-copy"),
daemonRunning,
hasService,
hasUinput,
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index 2a5c51b07..a647ef971 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -3323,8 +3323,8 @@ class IPCHandlers {
// Promise cannot cross Electron's IPC boundary, though, and renderer
// callers need to know whether text was pasted, but not the delayed
// clipboard restoration promise. Successful platform paths predate the
- // explicit `pasted` outcome; only the clipboard-only fallback and a paste
- // held back for still-held modifiers (which carries a `reason`) set false.
+ // explicit `pasted` outcome; only the clipboard-only fallback and a held-back
+ // paste (held modifiers or a missing or failed wl-copy, which carries a `reason`) set false.
return {
success: true,
pasted,
diff --git a/src/helpers/linuxSession.js b/src/helpers/linuxSession.js
index 073de5517..f9ea1b9e8 100644
--- a/src/helpers/linuxSession.js
+++ b/src/helpers/linuxSession.js
@@ -24,11 +24,17 @@ function getLinuxSessionInfo(environment = process.env) {
!isKde &&
!isHyprland &&
(desktopEnv.includes("sway") || (!desktopEnv && !!environment.SWAYSOCK));
+ const isNamedWlroots = WLROOTS_DESKTOPS.some((desktop) => desktopEnv.includes(desktop));
const isWlroots =
isWayland &&
- (WLROOTS_DESKTOPS.some((desktop) => desktopEnv.includes(desktop)) ||
- !!environment.SWAYSOCK ||
- !!environment.HYPRLAND_INSTANCE_SIGNATURE);
+ (isNamedWlroots || !!environment.SWAYSOCK || !!environment.HYPRLAND_INSTANCE_SIGNATURE);
+ const isNiri = isWayland && desktopEnv.includes("niri");
+ // wlroots, Hyprland and niri's xwayland-satellite hand an X11 clipboard write to
+ // Wayland apps only while an X11 window has focus (KWin, Mutter and COSMIC do it
+ // themselves), so the app's XWayland clipboard reaches a native Wayland app only
+ // through wl-copy. A stale SWAYSOCK or Hyprland signature alone doesn't count.
+ const requiresWlCopy =
+ isWayland && !isGnome && !isKde && !isCosmic && (isNamedWlroots || isSway || isNiri);
return {
isWayland,
@@ -40,6 +46,7 @@ function getLinuxSessionInfo(environment = process.env) {
isHyprland,
isSway,
isCosmic,
+ requiresWlCopy,
};
}
diff --git a/src/helpers/selectionManager.js b/src/helpers/selectionManager.js
index 98fe144c7..f925dc4a2 100644
--- a/src/helpers/selectionManager.js
+++ b/src/helpers/selectionManager.js
@@ -92,10 +92,17 @@ function runSpawn(command, args, options = {}) {
});
}
-// Keys still held past the modifier wait (#2113) get their own code, so the
-// renderer can say so instead of blaming permissions or a changed target.
+// Keys still held past the modifier wait (#2113) and a Wayland clipboard wl-copy
+// didn't write (#2621) get their own code, so the renderer can say so instead of
+// blaming permissions or a changed target.
+const HELD_BACK_CODES = {
+ "modifiers-held": "modifiers_held",
+ "wl-copy-missing": "wl_copy_missing",
+ "wl-copy-failed": "wl_copy_failed",
+};
+
function heldBackCode(fallback, { code, reason } = {}) {
- return code === "modifiers_held" || reason === "modifiers-held" ? "modifiers_held" : fallback;
+ return code === "modifiers_held" ? code : HELD_BACK_CODES[reason] || fallback;
}
class SelectionManager {
diff --git a/src/hooks/useAudioRecording.js b/src/hooks/useAudioRecording.js
index dc8f7627c..bcfa1878e 100644
--- a/src/hooks/useAudioRecording.js
+++ b/src/hooks/useAudioRecording.js
@@ -34,6 +34,13 @@ const SELECTION_EDIT_DETAIL_KEY_BY_CODE = {
selection_changed: "changed",
session_expired: "expired",
paste_failed: "pasteFailed",
+ wl_copy_missing: "wlCopyMissing",
+ wl_copy_failed: "wlCopyFailed",
+};
+// Pastes held back because Wayland apps can't read the text yet (#2621).
+const WAYLAND_CLIPBOARD_REASON_KEYS = {
+ "wl-copy-missing": "wlCopyMissing",
+ "wl-copy-failed": "wlCopyFailed",
};
const COMPANION_AUDIO_LEVEL_INTERVAL_MS = 80;
@@ -774,8 +781,8 @@ export const useAudioRecording = (toast, options = {}) => {
}
};
- // A paste held back because keys were still down keeps the transcript
- // and says why it did not land. `onRetry`, when given, replaces the
+ // A paste held back (keys still down, or no Wayland clipboard written) keeps
+ // the transcript and says why it did not land. `onRetry`, when given, replaces the
// pill's record-again Retry. `generation` is the pill
// generation when the attempt began: if the next dictation started while
// it waited, that recording owns the pill (and would dismiss this one at
@@ -827,6 +834,22 @@ export const useAudioRecording = (toast, options = {}) => {
},
generation
);
+ } else if (WAYLAND_CLIPBOARD_REASON_KEYS[pasteOutcome.reason]) {
+ // Wayland apps may not read the clipboard copy here either, so the text
+ // never claims to be on it. Retry writes and pastes the kept text again.
+ const description = t(
+ `hooks.audioRecording.waylandClipboard.${WAYLAND_CLIPBOARD_REASON_KEYS[pasteOutcome.reason]}`
+ );
+ await reportHeldBackPaste(
+ pasteOutcome.reason,
+ {
+ title: t("hooks.audioRecording.waylandClipboard.title"),
+ description,
+ descriptionClipboardFailed: description,
+ onRetry: pasteTranscript,
+ },
+ generation
+ );
}
return pasteOutcome.pasted;
};
diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json
index 5b3ce5e71..5dacbb14f 100644
--- a/src/locales/ar/translation.json
+++ b/src/locales/ar/translation.json
@@ -69,7 +69,9 @@
"reasoningFailed": "لم يتمكن الذكاء الاصطناعي من إكمال تعديل التحديد. لم يتم تغيير نصك الأصلي.",
"invalidResponse": "أعاد الذكاء الاصطناعي استجابة تحرير غير صالحة. لم يتم استبدال أي نص. حدد النص وحاول مرة أخرى.",
"emptyResponse": "أعاد الذكاء الاصطناعي تعديلاً فارغاً. لم يتم استبدال أي نص. جرّب تعليمة أكثر تحديداً.",
- "truncatedResponse": "توقف الذكاء الاصطناعي قبل إكمال التعديل. لم يتم استبدال أي نص. جرّب تحديد نص أقل."
+ "truncatedResponse": "توقف الذكاء الاصطناعي قبل إكمال التعديل. لم يتم استبدال أي نص. جرّب تحديد نص أقل.",
+ "wlCopyMissing": "أنشأ OpenWhispr التعديل، لكن على سطح المكتب هذا لا تستطيع تطبيقات Wayland قراءة النص الملصوق إلا عبر wl-copy. ثبّت wl-clipboard لتطبيق التعديلات.",
+ "wlCopyFailed": "أنشأ OpenWhispr التعديل، لكن تعذّر على wl-copy نسخه لتطبيقات Wayland، لذا لم يتم تطبيقه."
},
"pushForceStopped": {
"title": "لم يتم لصق النص المفرَّغ",
@@ -93,7 +95,12 @@
"pasteFailed": {
"title": "تعذّر اللصق تلقائيًا"
},
- "interruptedRecordingRecovered": "تمت استعادته بعد إغلاق OpenWhispr قبل انتهاء هذا الإملاء."
+ "interruptedRecordingRecovered": "تمت استعادته بعد إغلاق OpenWhispr قبل انتهاء هذا الإملاء.",
+ "waylandClipboard": {
+ "title": "لم يتم لصق النص المفرَّغ",
+ "wlCopyMissing": "على سطح المكتب هذا، لا تستطيع تطبيقات Wayland قراءة النص الملصوق إلا عبر wl-copy. ثبّت wl-clipboard للصق الإملاء.",
+ "wlCopyFailed": "تعذّر على wl-copy نسخ النص لتطبيقات Wayland، لذا لم يتم لصقه. اضغط على إعادة المحاولة للمحاولة مرة أخرى."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -3719,6 +3726,10 @@
},
"xclip": {
"step1Title": "تثبيت xclip"
+ },
+ "wlCopy": {
+ "step1Title": "تثبيت wl-clipboard",
+ "step2Title": "التحقق من التثبيت"
}
},
"xclipDesc": "أداة الحافظة للصق في KDE Wayland (xclip أو xsel)",
@@ -3730,7 +3741,8 @@
"flakeTitle": "التثبيت عبر flake الخاص بنا؟",
"flakeDesc": "إذا قمت بتثبيت OpenWhispr من flake، فسيقوم programs.openwhispr.enable بتفعيل ydotool ووحدة uinput وعضويات المجموعة نيابة عنك.",
"rebuildNote": "قم بتشغيل sudo nixos-rebuild switch، ثم قم بتسجيل الخروج وتسجيل الدخول مرة أخرى حتى يسري تغيير المجموعة وقاعدة /dev/uinput. استبدل <you> باسم المستخدم الخاص بك."
- }
+ },
+ "wlCopyDesc": "أداة الحافظة التي تقرأ منها تطبيقات Wayland النص الملصوق على سطح المكتب هذا"
},
"updates": {
"automaticUpdates": "التحديثات التلقائية",
@@ -4484,7 +4496,9 @@
"withoutToolPrefix": "بدون هذه الأداة، سيقوم OpenWhispr بنسخ النص إلى الحافظة الخاصة بك. يمكنك بعد ذلك اللصق يدويًا باستخدام Ctrl+V.",
"wtypeCosmicTerminalsDescription": "على COSMIC، لا تستقبل الطرفيات مثل Warp النص الملصق إلا عبر wtype. أما التطبيقات الأخرى فيعمل فيها اللصق بدونه.",
"wtypeFallbackDescription": "يُعد wtype الطريقة المفضلة للصق التلقائي في مركب wlroots هذا. يتوفر بديل آخر، ولكنه قد يكون أقل موثوقية.",
- "xwaylandAppsOnly": "اللصق التلقائي يعمل مع تطبيقات XWayland فقط"
+ "xwaylandAppsOnly": "اللصق التلقائي يعمل مع تطبيقات XWayland فقط",
+ "wlClipboardTitle": "ثبّت wl-clipboard للصق في تطبيقات Wayland",
+ "wlClipboardDescription": "على سطح المكتب هذا، لا تستطيع تطبيقات Wayland قراءة النص الذي ينسخه OpenWhispr إلا عبر wl-copy. للصق الإملاء فيها، ثبّت wl-clipboard:"
},
"settingsModal": {
"managedByOrg": "تتم إدارة بعض الإعدادات بواسطة مؤسستك.",
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index d2055981a..3e3f1f960 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "Die KI konnte die Auswahlbearbeitung nicht abschließen. Dein ursprünglicher Text wurde nicht geändert.",
"invalidResponse": "Die KI hat eine ungültige Bearbeitungsantwort zurückgegeben. Es wurde nichts ersetzt. Wähle den Text aus und versuche es erneut.",
"emptyResponse": "Die KI hat eine leere Bearbeitung zurückgegeben. Es wurde nichts ersetzt. Versuche eine genauere Anweisung.",
- "truncatedResponse": "Die KI hat die Bearbeitung vorzeitig beendet. Es wurde nichts ersetzt. Versuche, weniger Text auszuwählen."
+ "truncatedResponse": "Die KI hat die Bearbeitung vorzeitig beendet. Es wurde nichts ersetzt. Versuche, weniger Text auszuwählen.",
+ "wlCopyMissing": "OpenWhispr hat die Änderung erstellt, aber auf diesem Desktop können Wayland-Apps eingefügten Text nur über wl-copy lesen. Installiere wl-clipboard, um Änderungen anzuwenden.",
+ "wlCopyFailed": "OpenWhispr hat die Änderung erstellt, aber wl-copy konnte sie nicht für Wayland-Apps kopieren, daher wurde sie nicht angewendet."
},
"pastePermission": {
"title": "Automatisches Einfügen erlauben",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "Automatisches Einfügen fehlgeschlagen"
},
- "interruptedRecordingRecovered": "Wiederhergestellt, nachdem OpenWhispr vor dem Ende dieses Diktats beendet wurde."
+ "interruptedRecordingRecovered": "Wiederhergestellt, nachdem OpenWhispr vor dem Ende dieses Diktats beendet wurde.",
+ "waylandClipboard": {
+ "title": "Transkription nicht eingefügt",
+ "wlCopyMissing": "Auf diesem Desktop können Wayland-Apps eingefügten Text nur über wl-copy lesen. Installiere wl-clipboard, um deine Diktate einzufügen.",
+ "wlCopyFailed": "wl-copy konnte den Text nicht für Wayland-Apps kopieren, daher wurde er nicht eingefügt. Klicke auf „Erneut versuchen“, um es noch einmal zu versuchen."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1518,7 +1525,9 @@
"withoutToolPrefix": "Ohne dieses Tool kopiert OpenWhispr den Text in Ihre Zwischenablage. Sie können ihn dann manuell mit Ctrl+V einfügen.",
"wtypeCosmicTerminalsDescription": "Unter COSMIC empfangen Terminals wie Warp eingefügten Text nur über wtype. In andere Apps wird bereits ohne wtype eingefügt.",
"wtypeFallbackDescription": "wtype ist die bevorzugte Methode für automatisches Einfügen auf diesem wlroots-Compositor. Eine Alternative ist verfügbar, kann aber weniger zuverlässig sein.",
- "xwaylandAppsOnly": "Automatisches Einfügen funktioniert nur für XWayland-Apps"
+ "xwaylandAppsOnly": "Automatisches Einfügen funktioniert nur für XWayland-Apps",
+ "wlClipboardTitle": "Installieren Sie wl-clipboard, um in Wayland-Apps einzufügen",
+ "wlClipboardDescription": "Auf diesem Desktop können Wayland-Apps von OpenWhispr kopierten Text nur über wl-copy lesen. Um Diktate dort einzufügen, installieren Sie wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2365,6 +2374,10 @@
},
"xclip": {
"step1Title": "xclip installieren"
+ },
+ "wlCopy": {
+ "step1Title": "wl-clipboard installieren",
+ "step2Title": "Installation überprüfen"
}
},
"xclipDesc": "Zwischenablage-Tool für KDE-Wayland-Einfügen (xclip oder xsel)",
@@ -2376,7 +2389,8 @@
"flakeTitle": "Installation über unser flake?",
"flakeDesc": "Wenn Sie OpenWhispr über das flake installieren, aktiviert programs.openwhispr.enable automatisch ydotool, das uinput-Modul und die erforderlichen Gruppenmitgliedschaften.",
"rebuildNote": "Führen Sie sudo nixos-rebuild switch aus, dann ab- und wieder anmelden, damit die Gruppenänderung und die /dev/uinput-Regel wirksam werden. Ersetzen Sie <you> durch Ihren Benutzernamen."
- }
+ },
+ "wlCopyDesc": "Zwischenablage-Tool, aus dem Wayland-Apps auf diesem Desktop eingefügten Text lesen"
},
"updates": {
"automaticUpdates": "Automatische Updates",
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 6e97e3bf9..b96f5cf8b 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "The AI could not complete the selection edit. Your original text was not changed.",
"invalidResponse": "The AI returned an invalid edit response. Nothing was replaced. Select the text and try again.",
"emptyResponse": "The AI returned an empty edit. Nothing was replaced. Try a more specific instruction.",
- "truncatedResponse": "The AI stopped before completing the edit. Nothing was replaced. Try selecting less text."
+ "truncatedResponse": "The AI stopped before completing the edit. Nothing was replaced. Try selecting less text.",
+ "wlCopyMissing": "OpenWhispr generated the edit, but on this desktop Wayland apps can only read pasted text through wl-copy. Install wl-clipboard to apply edits.",
+ "wlCopyFailed": "OpenWhispr generated the edit, but wl-copy couldn't copy it for Wayland apps, so it wasn't applied."
},
"pastePermission": {
"title": "Allow automatic pasting",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "Couldn't paste automatically"
},
- "interruptedRecordingRecovered": "Recovered after OpenWhispr closed before this dictation finished."
+ "interruptedRecordingRecovered": "Recovered after OpenWhispr closed before this dictation finished.",
+ "waylandClipboard": {
+ "title": "Transcription not pasted",
+ "wlCopyMissing": "On this desktop, Wayland apps can only read pasted text through wl-copy. Install wl-clipboard to paste your dictations.",
+ "wlCopyFailed": "wl-copy couldn't copy the text for Wayland apps, so it wasn't pasted. Press Retry to try again."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1518,7 +1525,9 @@
"withoutToolPrefix": "Without this tool, OpenWhispr will copy text to your clipboard. You can then paste manually with Ctrl+V.",
"wtypeCosmicTerminalsDescription": "On COSMIC, terminals such as Warp only receive pasted text through wtype. Other apps already paste without it.",
"wtypeFallbackDescription": "wtype is the preferred auto-paste method for this wlroots compositor. A fallback is available, but may be less reliable.",
- "xwaylandAppsOnly": "automatic pasting works for XWayland apps only"
+ "xwaylandAppsOnly": "automatic pasting works for XWayland apps only",
+ "wlClipboardTitle": "Install wl-clipboard to paste into Wayland apps",
+ "wlClipboardDescription": "On this desktop, Wayland apps can only read text that OpenWhispr copies through wl-copy. To paste dictation into them, install wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2365,6 +2374,10 @@
},
"xclip": {
"step1Title": "Install xclip"
+ },
+ "wlCopy": {
+ "step1Title": "Install wl-clipboard",
+ "step2Title": "Verify installation"
}
},
"xclipDesc": "Clipboard tool for KDE Wayland paste (xclip or xsel)",
@@ -2376,7 +2389,8 @@
"flakeTitle": "Installing via our flake?",
"flakeDesc": "If you install OpenWhispr from the flake, programs.openwhispr.enable turns on ydotool, the uinput module and the group memberships for you.",
"rebuildNote": "Run sudo nixos-rebuild switch, then log out and back in so the group change and the /dev/uinput rule take effect. Replace <you> with your username."
- }
+ },
+ "wlCopyDesc": "Clipboard tool that Wayland apps read pasted text from on this desktop"
},
"updates": {
"automaticUpdates": "Automatic updates",
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 22bcc5c73..5920a7eb9 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "La IA no pudo completar la edición. El texto original no se modificó.",
"invalidResponse": "La IA devolvió una respuesta de edición no válida. No se reemplazó nada. Selecciona el texto e inténtalo de nuevo.",
"emptyResponse": "La IA devolvió una edición vacía. No se reemplazó nada. Prueba con una instrucción más específica.",
- "truncatedResponse": "La IA se detuvo antes de completar la edición. No se reemplazó nada. Prueba seleccionando menos texto."
+ "truncatedResponse": "La IA se detuvo antes de completar la edición. No se reemplazó nada. Prueba seleccionando menos texto.",
+ "wlCopyMissing": "OpenWhispr generó la edición, pero en este escritorio las apps de Wayland solo pueden leer el texto pegado a través de wl-copy. Instala wl-clipboard para aplicar las ediciones.",
+ "wlCopyFailed": "OpenWhispr generó la edición, pero wl-copy no pudo copiarla para las apps de Wayland, así que no se aplicó."
},
"pastePermission": {
"title": "Permitir el pegado automático",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "No se pudo pegar automáticamente"
},
- "interruptedRecordingRecovered": "Recuperado después de que OpenWhispr se cerrara antes de terminar este dictado."
+ "interruptedRecordingRecovered": "Recuperado después de que OpenWhispr se cerrara antes de terminar este dictado.",
+ "waylandClipboard": {
+ "title": "Transcripción no pegada",
+ "wlCopyMissing": "En este escritorio, las apps de Wayland solo pueden leer el texto pegado a través de wl-copy. Instala wl-clipboard para pegar tus dictados.",
+ "wlCopyFailed": "wl-copy no pudo copiar el texto para las apps de Wayland, así que no se pegó. Pulsa Reintentar para volver a intentarlo."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1476,7 +1483,9 @@
"withoutToolPrefix": "Sin esta herramienta, OpenWhispr copiará el texto al portapapeles. Luego puedes pegarlo manualmente con Ctrl+V.",
"wtypeCosmicTerminalsDescription": "En COSMIC, las terminales como Warp solo reciben el texto pegado mediante wtype. En las demás aplicaciones ya se pega sin él.",
"wtypeFallbackDescription": "wtype es el método de pegado automático preferido para este compositor wlroots. Hay una alternativa disponible, pero puede ser menos fiable.",
- "xwaylandAppsOnly": "el pegado automático funciona solo en apps XWayland"
+ "xwaylandAppsOnly": "el pegado automático funciona solo en apps XWayland",
+ "wlClipboardTitle": "Instala wl-clipboard para pegar en apps de Wayland",
+ "wlClipboardDescription": "En este escritorio, las apps de Wayland solo pueden leer el texto que OpenWhispr copia a través de wl-copy. Para pegar el dictado en ellas, instala wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2123,6 +2132,10 @@
},
"xclip": {
"step1Title": "Instalar xclip"
+ },
+ "wlCopy": {
+ "step1Title": "Instalar wl-clipboard",
+ "step2Title": "Verificar la instalación"
}
},
"xclipDesc": "Herramienta de portapapeles para pegado en KDE Wayland (xclip o xsel)",
@@ -2134,7 +2147,8 @@
"flakeTitle": "¿Instalando mediante nuestro flake?",
"flakeDesc": "Si instalas OpenWhispr desde el flake, programs.openwhispr.enable activa ydotool, el módulo uinput y las pertenencias de grupo por ti.",
"rebuildNote": "Ejecuta sudo nixos-rebuild switch, luego cierra sesión y vuelve a abrirla para que el cambio de grupo y la regla de /dev/uinput surtan efecto. Sustituye <you> por tu nombre de usuario."
- }
+ },
+ "wlCopyDesc": "Herramienta de portapapeles de la que las apps de Wayland leen el texto pegado en este escritorio"
},
"updates": {
"automaticUpdates": "Actualizaciones automáticas",
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index b183f6dd3..d50da811c 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "L’IA n’a pas pu terminer la modification. Le texte d’origine n’a pas été modifié.",
"invalidResponse": "L’IA a renvoyé une réponse de modification invalide. Rien n’a été remplacé. Sélectionnez le texte et réessayez.",
"emptyResponse": "L’IA a renvoyé une modification vide. Rien n’a été remplacé. Essayez une instruction plus précise.",
- "truncatedResponse": "L’IA s’est arrêtée avant de terminer la modification. Rien n’a été remplacé. Essayez de sélectionner moins de texte."
+ "truncatedResponse": "L’IA s’est arrêtée avant de terminer la modification. Rien n’a été remplacé. Essayez de sélectionner moins de texte.",
+ "wlCopyMissing": "OpenWhispr a généré la modification, mais sur ce bureau les applications Wayland ne peuvent lire le texte collé que via wl-copy. Installez wl-clipboard pour appliquer les modifications.",
+ "wlCopyFailed": "OpenWhispr a généré la modification, mais wl-copy n'a pas pu la copier pour les applications Wayland, elle n'a donc pas été appliquée."
},
"pastePermission": {
"title": "Autoriser le collage automatique",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "Collage automatique impossible"
},
- "interruptedRecordingRecovered": "Récupérée après la fermeture d'OpenWhispr avant la fin de cette dictée."
+ "interruptedRecordingRecovered": "Récupérée après la fermeture d'OpenWhispr avant la fin de cette dictée.",
+ "waylandClipboard": {
+ "title": "Transcription non collée",
+ "wlCopyMissing": "Sur ce bureau, les applications Wayland ne peuvent lire le texte collé que via wl-copy. Installez wl-clipboard pour coller vos dictées.",
+ "wlCopyFailed": "wl-copy n'a pas pu copier le texte pour les applications Wayland, il n'a donc pas été collé. Appuyez sur Réessayer pour recommencer."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1518,7 +1525,9 @@
"withoutToolPrefix": "Sans cet outil, OpenWhispr copiera le texte dans le presse-papiers. Vous pourrez ensuite coller manuellement avec Ctrl+V.",
"wtypeCosmicTerminalsDescription": "Sous COSMIC, les terminaux comme Warp ne reçoivent le texte collé que via wtype. Les autres applications collent déjà sans lui.",
"wtypeFallbackDescription": "wtype est la méthode de collage automatique recommandée pour ce compositeur wlroots. Une solution de repli est disponible, mais elle peut être moins fiable.",
- "xwaylandAppsOnly": "le collage automatique fonctionne uniquement pour les apps XWayland"
+ "xwaylandAppsOnly": "le collage automatique fonctionne uniquement pour les apps XWayland",
+ "wlClipboardTitle": "Installez wl-clipboard pour coller dans les applications Wayland",
+ "wlClipboardDescription": "Sur ce bureau, les applications Wayland ne peuvent lire le texte copié par OpenWhispr que via wl-copy. Pour y coller votre dictée, installez wl-clipboard :"
},
"promptStudio": {
"common": {
@@ -2365,6 +2374,10 @@
},
"xclip": {
"step1Title": "Installer xclip"
+ },
+ "wlCopy": {
+ "step1Title": "Installer wl-clipboard",
+ "step2Title": "Vérifier l'installation"
}
},
"xclipDesc": "Outil de presse-papiers pour le collage KDE Wayland (xclip ou xsel)",
@@ -2376,7 +2389,8 @@
"flakeTitle": "Vous installez via notre flake ?",
"flakeDesc": "Si vous installez OpenWhispr depuis le flake, programs.openwhispr.enable active ydotool, le module uinput et les appartenances aux groupes pour vous.",
"rebuildNote": "Exécutez sudo nixos-rebuild switch, puis déconnectez-vous et reconnectez-vous pour que le changement de groupe et la règle /dev/uinput prennent effet. Remplacez <you> par votre nom d'utilisateur."
- }
+ },
+ "wlCopyDesc": "Outil de presse-papiers dans lequel les applications Wayland lisent le texte collé sur ce bureau"
},
"updates": {
"automaticUpdates": "Mises à jour automatiques",
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 2a8cbea34..433623af0 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "L’IA non ha potuto completare la modifica. Il testo originale non è stato cambiato.",
"invalidResponse": "L’IA ha restituito una risposta di modifica non valida. Non è stato sostituito nulla. Seleziona il testo e riprova.",
"emptyResponse": "L’IA ha restituito una modifica vuota. Non è stato sostituito nulla. Prova con un’istruzione più specifica.",
- "truncatedResponse": "L’IA si è fermata prima di completare la modifica. Non è stato sostituito nulla. Prova a selezionare meno testo."
+ "truncatedResponse": "L’IA si è fermata prima di completare la modifica. Non è stato sostituito nulla. Prova a selezionare meno testo.",
+ "wlCopyMissing": "OpenWhispr ha generato la modifica, ma su questo desktop le app Wayland possono leggere il testo incollato solo tramite wl-copy. Installa wl-clipboard per applicare le modifiche.",
+ "wlCopyFailed": "OpenWhispr ha generato la modifica, ma wl-copy non è riuscito a copiarla per le app Wayland, quindi non è stata applicata."
},
"pastePermission": {
"title": "Consenti di incollare automaticamente",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "Impossibile incollare automaticamente"
},
- "interruptedRecordingRecovered": "Recuperata dopo la chiusura di OpenWhispr prima della fine di questa dettatura."
+ "interruptedRecordingRecovered": "Recuperata dopo la chiusura di OpenWhispr prima della fine di questa dettatura.",
+ "waylandClipboard": {
+ "title": "Trascrizione non incollata",
+ "wlCopyMissing": "Su questo desktop, le app Wayland possono leggere il testo incollato solo tramite wl-copy. Installa wl-clipboard per incollare le tue dettature.",
+ "wlCopyFailed": "wl-copy non è riuscito a copiare il testo per le app Wayland, quindi non è stato incollato. Premi Riprova per riprovare."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1424,7 +1431,9 @@
"withoutToolPrefix": "Senza questo strumento, OpenWhispr copierà il testo negli appunti. Potrai poi incollare manualmente con Ctrl+V.",
"wtypeCosmicTerminalsDescription": "Su COSMIC, i terminali come Warp ricevono il testo incollato solo tramite wtype. Nelle altre app l'incollaggio funziona già senza.",
"wtypeFallbackDescription": "wtype è il metodo di incollaggio automatico preferito per questo compositor wlroots. È disponibile un'alternativa, ma potrebbe essere meno affidabile.",
- "xwaylandAppsOnly": "l'incollaggio automatico funziona solo per le app XWayland"
+ "xwaylandAppsOnly": "l'incollaggio automatico funziona solo per le app XWayland",
+ "wlClipboardTitle": "Installa wl-clipboard per incollare nelle app Wayland",
+ "wlClipboardDescription": "Su questo desktop, le app Wayland possono leggere il testo copiato da OpenWhispr solo tramite wl-copy. Per incollarvi la dettatura, installa wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2071,6 +2080,10 @@
},
"xclip": {
"step1Title": "Installa xclip"
+ },
+ "wlCopy": {
+ "step1Title": "Installa wl-clipboard",
+ "step2Title": "Verifica l'installazione"
}
},
"xclipDesc": "Strumento appunti per incollare in KDE Wayland (xclip o xsel)",
@@ -2082,7 +2095,8 @@
"flakeTitle": "Stai installando tramite il nostro flake?",
"flakeDesc": "Se installi OpenWhispr dal flake, programs.openwhispr.enable attiva ydotool, il modulo uinput e le appartenenze ai gruppi per te.",
"rebuildNote": "Esegui sudo nixos-rebuild switch, poi disconnettiti e riconnettiti affinché la modifica al gruppo e la regola /dev/uinput abbiano effetto. Sostituisci <you> con il tuo nome utente."
- }
+ },
+ "wlCopyDesc": "Strumento degli appunti da cui le app Wayland leggono il testo incollato su questo desktop"
},
"updates": {
"automaticUpdates": "Aggiornamenti automatici",
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 573000543..6897a778a 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "AI は選択範囲の編集を完了できませんでした。元のテキストは変更されていません。",
"invalidResponse": "AI が無効な編集応答を返しました。テキストは置き換えられていません。テキストを選択して、もう一度お試しください。",
"emptyResponse": "AI が空の編集結果を返しました。テキストは置き換えられていません。より具体的な指示をお試しください。",
- "truncatedResponse": "AI が編集の完了前に停止しました。テキストは置き換えられていません。選択するテキストを減らしてお試しください。"
+ "truncatedResponse": "AI が編集の完了前に停止しました。テキストは置き換えられていません。選択するテキストを減らしてお試しください。",
+ "wlCopyMissing": "OpenWhispr は編集を生成しましたが、このデスクトップでは Wayland アプリは wl-copy を通してしか貼り付けたテキストを読み取れません。編集を適用するには wl-clipboard をインストールしてください。",
+ "wlCopyFailed": "OpenWhispr は編集を生成しましたが、wl-copy が Wayland アプリ向けにコピーできなかったため、適用されませんでした。"
},
"pastePermission": {
"title": "自動貼り付けを許可",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "自動貼り付けに失敗しました"
},
- "interruptedRecordingRecovered": "このディクテーションの完了前に OpenWhispr が終了したため、録音を復元しました。"
+ "interruptedRecordingRecovered": "このディクテーションの完了前に OpenWhispr が終了したため、録音を復元しました。",
+ "waylandClipboard": {
+ "title": "文字起こしは貼り付けられませんでした",
+ "wlCopyMissing": "このデスクトップでは、Wayland アプリは wl-copy を通してしか貼り付けたテキストを読み取れません。音声入力を貼り付けるには wl-clipboard をインストールしてください。",
+ "wlCopyFailed": "wl-copy が Wayland アプリ向けにテキストをコピーできなかったため、貼り付けられませんでした。「再試行」を押してもう一度お試しください。"
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1424,7 +1431,9 @@
"withoutToolPrefix": "このツールがない場合、OpenWhispr はテキストをクリップボードにコピーします。Ctrl+V で手動で貼り付けてください。",
"wtypeCosmicTerminalsDescription": "COSMIC では、Warp などのターミナルは wtype 経由でのみ貼り付けを受け取ります。その他のアプリには wtype なしで貼り付けられます。",
"wtypeFallbackDescription": "この wlroots 系コンポジターでは wtype が推奨される自動貼り付け方法です。代替手段も利用できますが、信頼性が低い場合があります。",
- "xwaylandAppsOnly": "自動貼り付けは XWayland アプリのみで動作します"
+ "xwaylandAppsOnly": "自動貼り付けは XWayland アプリのみで動作します",
+ "wlClipboardTitle": "Wayland アプリに貼り付けるには wl-clipboard をインストールしてください",
+ "wlClipboardDescription": "このデスクトップでは、Wayland アプリは OpenWhispr がコピーしたテキストを wl-copy を通してしか読み取れません。音声入力を貼り付けるには、wl-clipboard をインストールしてください:"
},
"promptStudio": {
"common": {
@@ -2071,6 +2080,10 @@
},
"xclip": {
"step1Title": "xclipをインストール"
+ },
+ "wlCopy": {
+ "step1Title": "wl-clipboard をインストール",
+ "step2Title": "インストールの確認"
}
},
"xclipDesc": "KDE Waylandの貼り付け用クリップボードツール(xclipまたはxsel)",
@@ -2082,7 +2095,8 @@
"flakeTitle": "flakeからインストールする場合",
"flakeDesc": "flakeからOpenWhisprをインストールする場合、programs.openwhispr.enableを有効にするとydotool、uinputモジュール、グループのメンバーシップが自動で設定されます。",
"rebuildNote": "sudo nixos-rebuild switchを実行し、グループの変更と/dev/uinputのルールを反映させるためにログアウト後に再ログインしてください。<you>はあなたのユーザー名に置き換えてください。"
- }
+ },
+ "wlCopyDesc": "このデスクトップで Wayland アプリが貼り付けるテキストを読み取るクリップボードツール"
},
"updates": {
"automaticUpdates": "自動アップデート",
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 4b2d1900e..e4d479390 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -955,7 +955,9 @@
"reasoningFailed": "A IA não conseguiu concluir a edição. O texto original não foi alterado.",
"invalidResponse": "A IA retornou uma resposta de edição inválida. Nada foi substituído. Selecione o texto e tente novamente.",
"emptyResponse": "A IA retornou uma edição vazia. Nada foi substituído. Tente uma instrução mais específica.",
- "truncatedResponse": "A IA parou antes de concluir a edição. Nada foi substituído. Tente selecionar menos texto."
+ "truncatedResponse": "A IA parou antes de concluir a edição. Nada foi substituído. Tente selecionar menos texto.",
+ "wlCopyMissing": "O OpenWhispr gerou a edição, mas nesta área de trabalho os apps Wayland só conseguem ler o texto colado através do wl-copy. Instale o wl-clipboard para aplicar edições.",
+ "wlCopyFailed": "O OpenWhispr gerou a edição, mas o wl-copy não conseguiu copiá-la para os apps Wayland, por isso ela não foi aplicada."
},
"pastePermission": {
"title": "Permitir colagem automática",
@@ -969,7 +971,12 @@
"pasteFailed": {
"title": "Não foi possível colar automaticamente"
},
- "interruptedRecordingRecovered": "Recuperado após o OpenWhispr fechar antes de terminar este ditado."
+ "interruptedRecordingRecovered": "Recuperado após o OpenWhispr fechar antes de terminar este ditado.",
+ "waylandClipboard": {
+ "title": "Transcrição não colada",
+ "wlCopyMissing": "Nesta área de trabalho, os apps Wayland só conseguem ler o texto colado através do wl-copy. Instale o wl-clipboard para colar seus ditados.",
+ "wlCopyFailed": "O wl-copy não conseguiu copiar o texto para os apps Wayland, por isso ele não foi colado. Clique em Tentar novamente para tentar de novo."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1403,7 +1410,9 @@
"withoutToolPrefix": "Sem essa ferramenta, o OpenWhispr copiará o texto para a área de transferência. Você poderá colar manualmente com Ctrl+V.",
"wtypeCosmicTerminalsDescription": "No COSMIC, terminais como o Warp só recebem texto colado pelo wtype. Nos outros apps, a colagem já funciona sem ele.",
"wtypeFallbackDescription": "O wtype é o método de colagem automática preferido para este compositor wlroots. Há uma alternativa disponível, mas ela pode ser menos confiável.",
- "xwaylandAppsOnly": "a colagem automática funciona apenas para apps XWayland"
+ "xwaylandAppsOnly": "a colagem automática funciona apenas para apps XWayland",
+ "wlClipboardTitle": "Instale o wl-clipboard para colar em apps Wayland",
+ "wlClipboardDescription": "Nesta área de trabalho, os apps Wayland só conseguem ler o texto que o OpenWhispr copia através do wl-copy. Para colar o ditado neles, instale o wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2050,6 +2059,10 @@
},
"xclip": {
"step1Title": "Instalar xclip"
+ },
+ "wlCopy": {
+ "step1Title": "Instalar o wl-clipboard",
+ "step2Title": "Verificar a instalação"
}
},
"xclipDesc": "Ferramenta de área de transferência para colar no KDE Wayland (xclip ou xsel)",
@@ -2061,7 +2074,8 @@
"flakeTitle": "A instalar pelo nosso flake?",
"flakeDesc": "Se instalar o OpenWhispr pelo flake, programs.openwhispr.enable ativa o ydotool, o módulo uinput e as associações de grupo por si.",
"rebuildNote": "Execute sudo nixos-rebuild switch, depois termine a sessão e volte a entrar para que a alteração de grupo e a regra /dev/uinput entrem em vigor. Substitua <you> pelo seu nome de utilizador."
- }
+ },
+ "wlCopyDesc": "Ferramenta de área de transferência da qual os apps Wayland leem o texto colado nesta área de trabalho"
},
"updates": {
"automaticUpdates": "Atualizações automáticas",
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 834e21b76..a78dad848 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "ИИ не смог завершить изменение. Исходный текст не был изменён.",
"invalidResponse": "ИИ вернул неверный ответ для редактирования. Ничего не заменено. Выделите текст и попробуйте ещё раз.",
"emptyResponse": "ИИ вернул пустую правку. Ничего не заменено. Попробуйте дать более точную инструкцию.",
- "truncatedResponse": "ИИ остановился, не завершив редактирование. Ничего не заменено. Попробуйте выделить меньше текста."
+ "truncatedResponse": "ИИ остановился, не завершив редактирование. Ничего не заменено. Попробуйте выделить меньше текста.",
+ "wlCopyMissing": "OpenWhispr подготовил правку, но на этом рабочем столе приложения Wayland читают вставленный текст только через wl-copy. Установите wl-clipboard, чтобы применять правки.",
+ "wlCopyFailed": "OpenWhispr подготовил правку, но wl-copy не смог скопировать её для приложений Wayland, поэтому она не применена."
},
"pastePermission": {
"title": "Разрешите автоматическую вставку",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "Не удалось вставить автоматически"
},
- "interruptedRecordingRecovered": "Восстановлено: OpenWhispr закрылся до завершения этой диктовки."
+ "interruptedRecordingRecovered": "Восстановлено: OpenWhispr закрылся до завершения этой диктовки.",
+ "waylandClipboard": {
+ "title": "Расшифровка не вставлена",
+ "wlCopyMissing": "На этом рабочем столе приложения Wayland читают вставленный текст только через wl-copy. Установите wl-clipboard, чтобы вставлять диктовку.",
+ "wlCopyFailed": "wl-copy не смог скопировать текст для приложений Wayland, поэтому он не вставлен. Нажмите «Повторить», чтобы попробовать снова."
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1424,7 +1431,9 @@
"withoutToolPrefix": "Без этого инструмента OpenWhispr скопирует текст в буфер обмена. Вы сможете вставить его вручную с помощью Ctrl+V.",
"wtypeCosmicTerminalsDescription": "В COSMIC терминалы, такие как Warp, получают вставляемый текст только через wtype. В остальные приложения вставка уже работает без него.",
"wtypeFallbackDescription": "wtype — предпочтительный способ автоматической вставки для этого композитора wlroots. Доступен резервный вариант, но он может быть менее надёжным.",
- "xwaylandAppsOnly": "автоматическая вставка работает только для приложений XWayland"
+ "xwaylandAppsOnly": "автоматическая вставка работает только для приложений XWayland",
+ "wlClipboardTitle": "Установите wl-clipboard, чтобы вставлять текст в приложения Wayland",
+ "wlClipboardDescription": "На этом рабочем столе приложения Wayland читают текст, скопированный OpenWhispr, только через wl-copy. Чтобы вставлять в них диктовку, установите wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2075,6 +2084,10 @@
},
"xclip": {
"step1Title": "Установить xclip"
+ },
+ "wlCopy": {
+ "step1Title": "Установить wl-clipboard",
+ "step2Title": "Проверить установку"
}
},
"xclipDesc": "Инструмент буфера обмена для вставки в KDE Wayland (xclip или xsel)",
@@ -2086,7 +2099,8 @@
"flakeTitle": "Устанавливаете через наш flake?",
"flakeDesc": "Если вы устанавливаете OpenWhispr из flake, programs.openwhispr.enable автоматически включает ydotool, модуль uinput и нужные группы пользователей.",
"rebuildNote": "Выполните sudo nixos-rebuild switch, затем выйдите из системы и войдите снова, чтобы изменение группы и правило /dev/uinput вступили в силу. Замените <you> на ваше имя пользователя."
- }
+ },
+ "wlCopyDesc": "Инструмент буфера обмена, из которого приложения Wayland на этом рабочем столе читают вставленный текст"
},
"updates": {
"automaticUpdates": "Автоматические обновления",
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index c3903195b..e67b2d057 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "AI 无法完成选中文本编辑。原始文本未被更改。",
"invalidResponse": "AI 返回的编辑响应格式无效。未替换任何内容。请选中文本后重试。",
"emptyResponse": "AI 返回了空的编辑结果。未替换任何内容。请尝试更具体的指令。",
- "truncatedResponse": "AI 在完成编辑之前停止了。未替换任何内容。请尝试选择更少的文本。"
+ "truncatedResponse": "AI 在完成编辑之前停止了。未替换任何内容。请尝试选择更少的文本。",
+ "wlCopyMissing": "OpenWhispr 已生成编辑,但在此桌面上,Wayland 应用只能通过 wl-copy 读取粘贴的文本。请安装 wl-clipboard 以应用编辑。",
+ "wlCopyFailed": "OpenWhispr 已生成编辑,但 wl-copy 无法为 Wayland 应用复制它,因此未应用。"
},
"pastePermission": {
"title": "允许自动粘贴",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "无法自动粘贴"
},
- "interruptedRecordingRecovered": "OpenWhispr 在本次听写完成前关闭,已恢复此录音。"
+ "interruptedRecordingRecovered": "OpenWhispr 在本次听写完成前关闭,已恢复此录音。",
+ "waylandClipboard": {
+ "title": "转录内容未粘贴",
+ "wlCopyMissing": "在此桌面上,Wayland 应用只能通过 wl-copy 读取粘贴的文本。请安装 wl-clipboard 以粘贴听写内容。",
+ "wlCopyFailed": "wl-copy 无法为 Wayland 应用复制文本,因此未粘贴。点击“重试”再试一次。"
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1424,7 +1431,9 @@
"withoutToolPrefix": "如果不安装此工具,OpenWhispr 会将文本复制到剪贴板,你可以使用 Ctrl+V 手动粘贴。",
"wtypeCosmicTerminalsDescription": "在 COSMIC 上,Warp 等终端只能通过 wtype 接收粘贴的文本。其他应用无需 wtype 即可粘贴。",
"wtypeFallbackDescription": "wtype 是此 wlroots 合成器上的首选自动粘贴方式。有备用方案可用,但可能不太可靠。",
- "xwaylandAppsOnly": "自动粘贴仅适用于 XWayland 应用"
+ "xwaylandAppsOnly": "自动粘贴仅适用于 XWayland 应用",
+ "wlClipboardTitle": "安装 wl-clipboard 以粘贴到 Wayland 应用",
+ "wlClipboardDescription": "在此桌面上,Wayland 应用只能通过 wl-copy 读取 OpenWhispr 复制的文本。要将听写内容粘贴到这些应用中,请安装 wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2071,6 +2080,10 @@
},
"xclip": {
"step1Title": "安装 xclip"
+ },
+ "wlCopy": {
+ "step1Title": "安装 wl-clipboard",
+ "step2Title": "验证安装"
}
},
"xclipDesc": "KDE Wayland 粘贴用的剪贴板工具(xclip 或 xsel)",
@@ -2082,7 +2095,8 @@
"flakeTitle": "通过我们的 flake 安装?",
"flakeDesc": "如果您通过 flake 安装 OpenWhispr,programs.openwhispr.enable 会自动为您启用 ydotool、uinput 模块以及相应的用户组权限。",
"rebuildNote": "运行 sudo nixos-rebuild switch,然后注销并重新登录,使组变更和 /dev/uinput 规则生效。将 <you> 替换为您的用户名。"
- }
+ },
+ "wlCopyDesc": "此桌面上 Wayland 应用读取粘贴文本所用的剪贴板工具"
},
"updates": {
"automaticUpdates": "自动更新",
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 0cfa3e0d8..c018353d6 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -976,7 +976,9 @@
"reasoningFailed": "AI 無法完成選取文字編輯。原始文字未被變更。",
"invalidResponse": "AI 傳回的編輯回應格式無效。未取代任何內容。請選取文字後重試。",
"emptyResponse": "AI 傳回了空白的編輯結果。未取代任何內容。請嘗試更具體的指示。",
- "truncatedResponse": "AI 在完成編輯之前停止了。未取代任何內容。請嘗試選取較少的文字。"
+ "truncatedResponse": "AI 在完成編輯之前停止了。未取代任何內容。請嘗試選取較少的文字。",
+ "wlCopyMissing": "OpenWhispr 已產生編輯,但在此桌面上,Wayland 應用程式只能透過 wl-copy 讀取貼上的文字。請安裝 wl-clipboard 以套用編輯。",
+ "wlCopyFailed": "OpenWhispr 已產生編輯,但 wl-copy 無法為 Wayland 應用程式複製它,因此未套用。"
},
"pastePermission": {
"title": "允許自動貼上",
@@ -990,7 +992,12 @@
"pasteFailed": {
"title": "無法自動貼上"
},
- "interruptedRecordingRecovered": "OpenWhispr 在本次語音輸入完成前關閉,已復原此錄音。"
+ "interruptedRecordingRecovered": "OpenWhispr 在本次語音輸入完成前關閉,已復原此錄音。",
+ "waylandClipboard": {
+ "title": "轉錄內容未貼上",
+ "wlCopyMissing": "在此桌面上,Wayland 應用程式只能透過 wl-copy 讀取貼上的文字。請安裝 wl-clipboard 以貼上聽寫內容。",
+ "wlCopyFailed": "wl-copy 無法為 Wayland 應用程式複製文字,因此未貼上。點按「重試」再試一次。"
+ }
},
"clipboard": {
"pasteFailed": {
@@ -1424,7 +1431,9 @@
"withoutToolPrefix": "若未安裝此工具,OpenWhispr 會將文字複製到剪貼簿。你可以使用 Ctrl+V 手動貼上。",
"wtypeCosmicTerminalsDescription": "在 COSMIC 上,Warp 等終端機只能透過 wtype 接收貼上的文字。其他應用程式不需要 wtype 即可貼上。",
"wtypeFallbackDescription": "wtype 是此 wlroots 合成器上的首選自動貼上方式。有備用方案可用,但可能較不可靠。",
- "xwaylandAppsOnly": "自動貼上僅適用於 XWayland 應用程式"
+ "xwaylandAppsOnly": "自動貼上僅適用於 XWayland 應用程式",
+ "wlClipboardTitle": "安裝 wl-clipboard 以貼上到 Wayland 應用程式",
+ "wlClipboardDescription": "在此桌面上,Wayland 應用程式只能透過 wl-copy 讀取 OpenWhispr 複製的文字。若要將聽寫內容貼上到這些應用程式,請安裝 wl-clipboard:"
},
"promptStudio": {
"common": {
@@ -2071,6 +2080,10 @@
},
"xclip": {
"step1Title": "安裝 xclip"
+ },
+ "wlCopy": {
+ "step1Title": "安裝 wl-clipboard",
+ "step2Title": "驗證安裝"
}
},
"xclipDesc": "KDE Wayland 貼上用的剪貼簿工具(xclip 或 xsel)",
@@ -2082,7 +2095,8 @@
"flakeTitle": "透過我們的 flake 安裝?",
"flakeDesc": "若你從 flake 安裝 OpenWhispr,programs.openwhispr.enable 會自動啟用 ydotool、uinput 模組及所需的群組成員資格。",
"rebuildNote": "執行 sudo nixos-rebuild switch,然後登出並重新登入,使群組變更與 /dev/uinput 規則生效。將 <you> 替換為你的使用者名稱。"
- }
+ },
+ "wlCopyDesc": "此桌面上 Wayland 應用程式讀取貼上文字所用的剪貼簿工具"
},
"updates": {
"automaticUpdates": "自動更新",
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 577d22eb4..a90af10f0 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -1195,6 +1195,7 @@ export interface PasteToolsResult {
hasWtype?: boolean;
isWlroots?: boolean;
isCosmic?: boolean;
+ wlCopyMissing?: boolean;
tools?: string[];
recommendedInstall?: string;
}
@@ -1367,7 +1368,11 @@ declare global {
allowClipboardFallback?: boolean;
}
) => Promise<
- | { success: true; pasted: boolean; reason?: "modifiers-held" }
+ | {
+ success: true;
+ pasted: boolean;
+ reason?: "modifiers-held" | "wl-copy-missing" | "wl-copy-failed";
+ }
| {
success: false;
pasted: false;
@@ -1409,6 +1414,8 @@ declare global {
| "selection_changed"
| "paste_failed"
| "modifiers_held"
+ | "wl_copy_missing"
+ | "wl_copy_failed"
| "selection_manager_unavailable";
error?: string;
}>;
@@ -1424,6 +1431,8 @@ declare global {
| "target_changed"
| "paste_failed"
| "modifiers_held"
+ | "wl_copy_missing"
+ | "wl_copy_failed"
| "selection_manager_unavailable";
error?: string;
}>;
@@ -1971,7 +1980,7 @@ declare global {
checkAccessibilityPermission: (silent?: boolean) => Promise<boolean>;
promptAccessibilityPermission: () => Promise<boolean>;
readClipboard: () => Promise<string>;
- writeClipboard: (text: string) => Promise<{ success: boolean }>;
+ writeClipboard: (text: string) => Promise<{ success: boolean; xwaylandOnly?: boolean }>;
copyLeaderboardImage: (dataUrl: string) => Promise<{ success: boolean; error?: string }>;
saveLeaderboardImage: (
dataUrl: string,
@@ -2316,6 +2325,7 @@ declare global {
hasYdotool: boolean;
hasYdotoold: boolean;
hasWtype: boolean;
+ hasWlCopy: boolean;
daemonRunning: boolean;
hasService: boolean;
hasUinput: boolean;
@@ -2325,6 +2335,7 @@ declare global {
isKde: boolean;
isWlroots: boolean;
isCosmic: boolean;
+ requiresWlCopy: boolean;
hasXclip: boolean;
hasXsel: boolean;
}>;
diff --git a/src/utils/linuxPasteTools.ts b/src/utils/linuxPasteTools.ts
index eafdbc950..7de1c25fe 100644
--- a/src/utils/linuxPasteTools.ts
+++ b/src/utils/linuxPasteTools.ts
@@ -1,6 +1,6 @@
type Translate = (key: string) => string;
-export type LinuxPasteTool = "wtype" | "ydotool" | "xdotool";
+export type LinuxPasteTool = "wtype" | "ydotool" | "xdotool" | "wl-clipboard";
export interface LinuxPasteInstallCommand {
label: string;
@@ -45,6 +45,9 @@ export function needsWtype(pasteTools: PasteToolsResult) {
}
export function needsLinuxPasteToolGuidance(pasteTools: PasteToolsResult) {
- return pasteTools.platform === "linux" && (!pasteTools.available || needsWtype(pasteTools));
+ return (
+ pasteTools.platform === "linux" &&
+ (!pasteTools.available || needsWtype(pasteTools) || !!pasteTools.wlCopyMissing)
+ );
}
import type { PasteToolsResult } from "../types/electron";
diff --git a/test/components/pasteToolsInfo.test.js b/test/components/pasteToolsInfo.test.js
new file mode 100644
index 000000000..90aedfad6
--- /dev/null
+++ b/test/components/pasteToolsInfo.test.js
@@ -0,0 +1,55 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const { createElement } = require("react");
+const { renderToStaticMarkup } = require("react-dom/server");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+
+// The harness renders i18n keys verbatim, so assertions match keys.
+async function renderPasteToolsInfo(t, pasteToolsInfo) {
+ installBrowserGlobals(t);
+ const vite = await createRendererServer(t, { cachePrefix: "openwhispr-paste-tools-info-test-" });
+ const { default: PasteToolsInfo } = await vite.ssrLoadModule("/components/ui/PasteToolsInfo.tsx");
+ return renderToStaticMarkup(
+ createElement(PasteToolsInfo, { pasteToolsInfo, isChecking: false, onCheck: () => {} })
+ );
+}
+
+const SWAY = {
+ platform: "linux",
+ isWayland: true,
+ isWlroots: true,
+ hasWtype: true,
+ available: true,
+};
+
+// Without wl-copy (#2621) a manual Ctrl+V in a Wayland app pastes stale text too, so
+// the card never offers it as the way out.
+test("a missing wl-clipboard is the only ask when paste tools are in place", async (t) => {
+ const html = await renderPasteToolsInfo(t, { ...SWAY, wlCopyMissing: true });
+
+ assert.match(html, /pasteToolsInfo\.wlClipboardTitle/);
+ assert.match(html, /sudo apt install wl-clipboard/);
+ assert.doesNotMatch(html, /pasteToolsInfo\.optionalEnableTitle/);
+ assert.doesNotMatch(html, /pasteToolsInfo\.withoutToolPrefix/);
+});
+
+test("a missing wl-clipboard and a missing paste tool are asked for together", async (t) => {
+ const html = await renderPasteToolsInfo(t, { ...SWAY, hasWtype: false, wlCopyMissing: true });
+
+ assert.match(html, /sudo apt install wl-clipboard/);
+ assert.match(html, /pasteToolsInfo\.optionalEnableTitle/);
+ assert.match(html, /sudo apt install wtype/);
+ assert.doesNotMatch(html, /pasteToolsInfo\.withoutToolPrefix/);
+ assert.ok(
+ html.indexOf("wl-clipboard") < html.indexOf("install wtype"),
+ "wl-clipboard comes first"
+ );
+});
+
+test("a missing paste tool alone keeps its card", async (t) => {
+ const html = await renderPasteToolsInfo(t, { ...SWAY, hasWtype: false });
+
+ assert.match(html, /sudo apt install wtype/);
+ assert.match(html, /pasteToolsInfo\.withoutToolPrefix/);
+ assert.doesNotMatch(html, /wl-clipboard/);
+});
diff --git a/test/helpers/assistantResponseDelivery.test.js b/test/helpers/assistantResponseDelivery.test.js
index e889655b9..5ee31197e 100644
--- a/test/helpers/assistantResponseDelivery.test.js
+++ b/test/helpers/assistantResponseDelivery.test.js
@@ -90,6 +90,30 @@ test("no Assistant target and a lost target both copy the completed response", a
}
});
+// On niri, wlroots and Hyprland without wl-copy (#2621), the app the user is in
+// can't read the copy, so the panel offers its Copy button instead of "Copied".
+test("a copy only XWayland apps can read is not reported as copied", async () => {
+ const { deliverAssistantResponse } = await deliveryModule;
+
+ for (const delivery of [{ mode: "clipboard" }, PASTE_DELIVERY]) {
+ const { dependencies, writes } = createDeliveryHarness(false);
+ const rendererWrites = [];
+ dependencies.electronAPI.writeClipboard = async (text) => {
+ writes.push(text);
+ return { success: true, xwaylandOnly: true };
+ };
+ dependencies.clipboard = { writeText: async (text) => rendererWrites.push(text) };
+
+ assert.deepEqual(
+ await deliverAssistantResponse(delivery, RESPONSE, dependencies),
+ { pasted: false, copied: false },
+ delivery.mode
+ );
+ assert.deepEqual(writes, [RESPONSE], delivery.mode);
+ assert.deepEqual(rendererWrites, [], `${delivery.mode}: no second write to the same clipboard`);
+ }
+});
+
const MARKDOWN_RESPONSE = "**Bold** start.\n\n* item one\n* item two";
const PLAIN_RESPONSE = "Bold start.\n\n- item one\n- item two";
diff --git a/test/helpers/clipboardRestore.test.js b/test/helpers/clipboardRestore.test.js
index 87e6ebf51..734c8b292 100644
--- a/test/helpers/clipboardRestore.test.js
+++ b/test/helpers/clipboardRestore.test.js
@@ -1046,6 +1046,232 @@ test("modifiers still held leave the text on the clipboard without injecting", a
assert.equal(restoreScheduled, false, "the transcript stays on the clipboard");
});
+// Stands in for `command -v` (only `installed` commands exist, and succeed) and for
+// wl-copy, whose status null is a write killed by its timeout.
+function linuxClipboardToolsSpawnSync(
+ installed,
+ { wlCopyStatus = 0, primaryStatus = wlCopyStatus } = {}
+) {
+ return (command, args = []) => {
+ if (command === "sh") {
+ return { status: installed.has(args[1].replace("command -v ", "")) ? 0 : 1 };
+ }
+ if (command === "wl-copy") {
+ return { status: args[0] === "--primary" ? primaryStatus : wlCopyStatus };
+ }
+ return { status: installed.has(command) ? 0 : 1, stdout: Buffer.from("") };
+ };
+}
+
+function loadLinuxPasteManager(t, spawnCalls, spawnSync) {
+ const platform = Object.getOwnPropertyDescriptor(process, "platform");
+ Object.defineProperty(process, "platform", { value: "linux" });
+ t.after(() => Object.defineProperty(process, "platform", platform));
+ const TestClipboardManager = loadClipboardManager({
+ spawn: createSpawn(spawnCalls, [0, 0], { stdout: ["MODIFIERS released 0\n"] }),
+ spawnSync,
+ realModifierWait: true,
+ });
+ const manager = new TestClipboardManager();
+ manager.resolveLinuxFastPasteBinary = () => "/tmp/linux-fast-paste";
+ manager._restoreClipboardAfterDelay = async () => {};
+ return manager;
+}
+
+// These compositors hand an X11 clipboard write to Wayland apps only while an X11
+// window has focus (#2621): with no Wayland clipboard written, every chord would
+// paste the clipboard from before the dictation.
+for (const [label, desktop, installed, statuses, reason] of [
+ ["niri without wl-copy", "niri", [], {}, "wl-copy-missing"],
+ ["Sway without wl-copy", "Sway", ["wtype"], {}, "wl-copy-missing"],
+ ["Hyprland without wl-copy", "Hyprland", ["hyprctl"], {}, "wl-copy-missing"],
+ ["niri with a timed-out wl-copy", "niri", ["wl-copy"], { wlCopyStatus: null }, "wl-copy-failed"],
+ // Apps paste the clipboard, so a written primary selection alone isn't enough.
+ [
+ "niri with a timed-out clipboard write",
+ "niri",
+ ["wl-copy"],
+ { wlCopyStatus: null, primaryStatus: 0 },
+ "wl-copy-failed",
+ ],
+ // Terminals paste the primary selection on Shift+Insert.
+ [
+ "niri with a timed-out primary write",
+ "niri",
+ ["wl-copy"],
+ { primaryStatus: null },
+ "wl-copy-failed",
+ ],
+ // xclip reaches only XWayland's primary selection.
+ [
+ "niri with a timed-out primary write and xclip",
+ "niri",
+ ["wl-copy", "xclip"],
+ { primaryStatus: null },
+ "wl-copy-failed",
+ ],
+]) {
+ test(`${label} injects nothing and says why`, async (t) => {
+ const spawnCalls = [];
+ const manager = loadLinuxPasteManager(
+ t,
+ spawnCalls,
+ linuxClipboardToolsSpawnSync(new Set(installed), statuses)
+ );
+ resetClipboard({ text: "previous" });
+
+ const result = await withWaylandEnvironment(desktop, () => manager._pasteText("transcript"));
+
+ assert.equal(result.pasted, false);
+ assert.equal(result.reason, reason);
+ assert.deepEqual(spawnCalls, [], "no modifier wait and no chord");
+ assert.equal(fakeClipboard.text, "transcript", "the text stays on the clipboard");
+ });
+}
+
+test("niri pastes once wl-copy wrote the Wayland clipboard", async (t) => {
+ const spawnCalls = [];
+ const manager = loadLinuxPasteManager(
+ t,
+ spawnCalls,
+ linuxClipboardToolsSpawnSync(new Set(["wl-copy"]))
+ );
+
+ const result = await withWaylandEnvironment("niri", () => manager._pasteText("transcript"));
+
+ assert.notEqual(result.pasted, false);
+ assert.deepEqual(spawnCalls, [
+ MODIFIER_WAIT_CALL,
+ { command: "/tmp/linux-fast-paste", args: ["--uinput", "--shift-insert"] },
+ ]);
+});
+
+// Linux refuses an argument of 128 KiB or more, which would hold back every Retry too.
+test("wl-copy takes text too long for an argument on stdin", async (t) => {
+ const wlCopyCalls = [];
+ const spawnSync = linuxClipboardToolsSpawnSync(new Set(["wl-copy"]));
+ const manager = loadLinuxPasteManager(t, [], (command, args = [], options = {}) => {
+ if (command === "wl-copy") wlCopyCalls.push({ args, input: options.input });
+ return spawnSync(command, args);
+ });
+ const longText = "x".repeat(128 * 1024);
+
+ await withWaylandEnvironment("niri", async () => {
+ await manager._pasteText("short");
+ await manager._pasteText(longText);
+ });
+
+ assert.deepEqual(wlCopyCalls, [
+ { args: ["--", "short"], input: undefined },
+ { args: ["--primary", "--", "short"], input: undefined },
+ { args: ["--type", "text/plain"], input: longText },
+ { args: ["--primary", "--type", "text/plain"], input: longText },
+ ]);
+});
+
+// A write killed early holds the paste back where wl-copy is required, and 50 ms is
+// shorter than a loaded system's round trip to the compositor.
+test("both wl-copy writes get 200 ms", async (t) => {
+ const timeouts = [];
+ const spawnSync = linuxClipboardToolsSpawnSync(new Set(["wl-copy"]));
+ const manager = loadLinuxPasteManager(t, [], (command, args = [], options = {}) => {
+ if (command === "wl-copy") timeouts.push(options.timeout);
+ return spawnSync(command, args);
+ });
+
+ await withWaylandEnvironment("niri", () => manager._pasteText("transcript"));
+
+ assert.deepEqual(timeouts, [200, 200]);
+});
+
+// The command cache keeps an answer for 30 s; a wl-copy installed after a held-back
+// paste must count for the next paste and the card's Re-check at once.
+test("a wl-copy installed after a held-back paste counts at once", async (t) => {
+ const spawnCalls = [];
+ const installed = new Set();
+ const manager = loadLinuxPasteManager(t, spawnCalls, linuxClipboardToolsSpawnSync(installed));
+ manager._canAccessUinput = () => true;
+
+ await withWaylandEnvironment("niri", async () => {
+ assert.equal((await manager._pasteText("first")).reason, "wl-copy-missing");
+ assert.equal(manager.checkPasteTools().wlCopyMissing, true);
+
+ installed.add("wl-copy");
+
+ assert.equal(manager.checkPasteTools().wlCopyMissing, false);
+ assert.notEqual((await manager._pasteText("second")).pasted, false);
+ });
+ assert.deepEqual(
+ spawnCalls.map((call) => call.args[0]),
+ ["--capabilities", "--uinput"],
+ "only the second paste waits and injects"
+ );
+});
+
+// Elsewhere (GNOME, COSMIC) wl-copy is optional, so its absence stays cached.
+test("a missing wl-copy stays cached where it is optional", async (t) => {
+ const platform = Object.getOwnPropertyDescriptor(process, "platform");
+ Object.defineProperty(process, "platform", { value: "linux" });
+ t.after(() => Object.defineProperty(process, "platform", platform));
+ const probes = [];
+ const TestClipboardManager = loadClipboardManager({
+ spawnSync: (command, args = []) => {
+ if (command === "sh") probes.push(args[1]);
+ return { status: 1, stdout: Buffer.from("") };
+ },
+ });
+ const manager = new TestClipboardManager();
+
+ await withWaylandEnvironment("GNOME", () => {
+ manager._writeClipboardWayland("first");
+ manager._writeClipboardWayland("second");
+ });
+ assert.equal(probes.filter((probe) => probe === "command -v wl-copy").length, 1);
+});
+
+test("a clipboard copy says when only XWayland apps can read it", async (t) => {
+ for (const [desktop, installed, statuses, xwaylandOnly] of [
+ ["niri", [], {}, true],
+ ["niri", ["wl-copy"], { wlCopyStatus: null }, true],
+ ["niri", ["wl-copy"], {}, false],
+ ["Sway", [], {}, true],
+ ["GNOME", [], {}, false],
+ ["KDE", [], {}, false],
+ ]) {
+ const manager = loadLinuxPasteManager(
+ t,
+ [],
+ linuxClipboardToolsSpawnSync(new Set(installed), statuses)
+ );
+
+ const result = await withWaylandEnvironment(desktop, () => manager.writeClipboard("answer"));
+
+ assert.deepEqual(result, { success: true, xwaylandOnly }, `${desktop}, ${installed}`);
+ }
+});
+
+test("the paste tools report a missing wl-copy only where it is required", async (t) => {
+ const platform = Object.getOwnPropertyDescriptor(process, "platform");
+ Object.defineProperty(process, "platform", { value: "linux" });
+ t.after(() => Object.defineProperty(process, "platform", platform));
+ const TestClipboardManager = loadClipboardManager();
+ const manager = new TestClipboardManager();
+ manager.resolveLinuxFastPasteBinary = () => "/tmp/linux-fast-paste";
+ manager._canAccessUinput = () => true;
+
+ for (const [desktop, hasWlCopy, wlCopyMissing] of [
+ ["niri", false, true],
+ ["niri", true, false],
+ ["Sway", false, true],
+ ["GNOME", false, false],
+ ["KDE", false, false],
+ ]) {
+ manager.commandExists = (command) => hasWlCopy && command === "wl-copy";
+ const status = await withWaylandEnvironment(desktop, () => manager.checkPasteTools());
+ assert.equal(status.wlCopyMissing, wlCopyMissing, `${desktop}, wl-copy ${hasWlCopy}`);
+ }
+});
+
// The wait can outlast a focus change (the user switches to a terminal while
// still holding a key), so the chord is chosen for the window focused once the
// keys are up — the one it will actually reach.
diff --git a/test/helpers/linuxSession.test.js b/test/helpers/linuxSession.test.js
index 066b84475..d349a1bc6 100644
--- a/test/helpers/linuxSession.test.js
+++ b/test/helpers/linuxSession.test.js
@@ -85,3 +85,47 @@ test("detects COSMIC without treating it as wlroots", () => {
assert.equal(session.isCosmic, true);
assert.equal(session.isWlroots, false);
});
+
+// wlroots, Hyprland and niri's xwayland-satellite keep an X11 clipboard write from a
+// focused Wayland app (#2621); KWin, Mutter and COSMIC hand it over themselves.
+test("requires wl-copy only where XWayland's clipboard needs X11 focus", () => {
+ const sessions = [
+ ["niri", { XDG_CURRENT_DESKTOP: "niri" }, true],
+ ["sway", { XDG_CURRENT_DESKTOP: "sway" }, true],
+ ["Hyprland", { XDG_CURRENT_DESKTOP: "Hyprland", HYPRLAND_INSTANCE_SIGNATURE: "x" }, true],
+ ["GNOME", { XDG_CURRENT_DESKTOP: "GNOME" }, false],
+ ["KDE", { XDG_CURRENT_DESKTOP: "KDE" }, false],
+ ["COSMIC", { XDG_CURRENT_DESKTOP: "COSMIC" }, false],
+ [
+ "GNOME with a stale SWAYSOCK",
+ { XDG_CURRENT_DESKTOP: "GNOME", SWAYSOCK: "/run/user/1000/stale-sway.sock" },
+ false,
+ ],
+ [
+ "Cinnamon with a stale SWAYSOCK and Hyprland signature",
+ {
+ XDG_CURRENT_DESKTOP: "X-Cinnamon",
+ SWAYSOCK: "/run/user/1000/stale-sway.sock",
+ HYPRLAND_INSTANCE_SIGNATURE: "stale",
+ },
+ false,
+ ],
+ ["a bare sway socket", { SWAYSOCK: "/run/user/1000/sway-ipc.sock" }, true],
+ [
+ "X11",
+ { XDG_SESSION_TYPE: "x11", WAYLAND_DISPLAY: undefined, XDG_CURRENT_DESKTOP: "i3" },
+ false,
+ ],
+ ];
+
+ for (const [name, environment, requiresWlCopy] of sessions) {
+ const session = getLinuxSessionInfo({
+ XDG_SESSION_TYPE: "wayland",
+ WAYLAND_DISPLAY: "wayland-1",
+ DISPLAY: ":0",
+ ...environment,
+ });
+
+ assert.equal(session.requiresWlCopy, requiresWlCopy, name);
+ }
+});
diff --git a/test/helpers/selectionManager.test.js b/test/helpers/selectionManager.test.js
index 3c669056c..7c54b2d31 100644
--- a/test/helpers/selectionManager.test.js
+++ b/test/helpers/selectionManager.test.js
@@ -289,6 +289,27 @@ test("a replacement whose paste was held back for modifiers reports modifiers_he
assert.equal(pastes.length, 1);
});
+// No Wayland clipboard written on wlroots, Hyprland or niri (#2621): the edit says
+// why rather than "could not replace".
+for (const [reason, code] of [
+ ["wl-copy-missing", "wl_copy_missing"],
+ ["wl-copy-failed", "wl_copy_failed"],
+]) {
+ test(`a replacement held back for ${reason} reports ${code}`, async () => {
+ const { manager, pastes } = makeHarness({
+ selections: ["original", "original"],
+ pasteResult: { restoreComplete: Promise.resolve(), pasted: false, reason },
+ });
+ const capture = await manager.captureSelectedText();
+
+ assert.deepEqual(await manager.replaceSelectedText(capture.sessionId, "improved"), {
+ success: false,
+ code,
+ });
+ assert.equal(pastes.length, 1);
+ });
+}
+
// The assistant's caret paste is blocked the same two ways. The renderer only
// reads `success`, so this code is for logs and support rather than UI.
test("an assistant caret paste held back by modifier keys reports modifiers_held", async () => {
diff --git a/test/helpers/useAudioRecordingForceStop.test.js b/test/helpers/useAudioRecordingForceStop.test.js
index 5440bb9d5..0734b00ab 100644
--- a/test/helpers/useAudioRecordingForceStop.test.js
+++ b/test/helpers/useAudioRecordingForceStop.test.js
@@ -281,6 +281,30 @@ test("a paste held back for still-held modifiers keeps the transcript", async (t
);
});
+// No Wayland clipboard written on wlroots, Hyprland or niri (#2621): Wayland apps
+// can't read the clipboard copy either, so the pill says why and Retry pastes again.
+for (const [reason, descriptionKey] of [
+ ["wl-copy-missing", "wlCopyMissing"],
+ ["wl-copy-failed", "wlCopyFailed"],
+]) {
+ test(`a paste held back for ${reason} keeps the transcript and retries the paste`, async (t) => {
+ const harness = await mountHarness(t, { pasteOutcome: { pasted: false, reason } });
+
+ await harness.complete();
+
+ const [toast] = errorToasts(harness);
+ assert.ok(toast, "the transcript is surfaced, not dropped");
+ assert.equal(toast.title, "hooks.audioRecording.waylandClipboard.title");
+ assert.equal(toast.description, `hooks.audioRecording.waylandClipboard.${descriptionKey}`);
+
+ globalThis.__forceStopPasteOutcome = { pasted: true };
+ await React.act(async () => retryAction(toast).onClick());
+
+ assert.equal(harness.pastes.length, 2);
+ assert.equal(harness.recordingStarts(), 0);
+ });
+}
+
// A macOS clipboard-only fallback (accessibility skipped) is also "not pasted",
// but it is expected and carries no reason, so it must stay silent.
test("a clipboard-only fallback without a reason raises no error", async (t) => {
diff --git a/test/utils/linuxPasteTools.test.js b/test/utils/linuxPasteTools.test.js
new file mode 100644
index 000000000..003ad1d86
--- /dev/null
+++ b/test/utils/linuxPasteTools.test.js
@@ -0,0 +1,20 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+let pasteToolsModule;
+
+test.before(async () => {
+ pasteToolsModule = await import("../../src/utils/linuxPasteTools.ts");
+});
+
+// Keys can be injected, but Wayland apps can't read the pasted text (#2621), so
+// the card must still ask for wl-clipboard.
+test("a missing wl-copy needs guidance even with a working paste method", () => {
+ const ready = { platform: "linux", available: true, method: "uinput", requiresPermission: false };
+
+ assert.equal(pasteToolsModule.needsLinuxPasteToolGuidance(ready), false);
+ assert.equal(
+ pasteToolsModule.needsLinuxPasteToolGuidance({ ...ready, wlCopyMissing: true }),
+ true
+ );
+});