From b479a368e79c845d6d714fa603556117b46a50df Mon Sep 17 00:00:00 2001 From: Jake Date: Sun, 19 Apr 2026 10:21:10 +0100 Subject: [PATCH] =?UTF-8?q?fix(clipboard):=20use=20navigator.clipboard.wri?= =?UTF-8?q?teText=20as=20primary,=20arboard=20as=20fallback=20=E2=80=94=20?= =?UTF-8?q?fixes=20silent=20failure=20on=20Linux/XWayland?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/pages/DictationPage.svelte | 10 ++++++++-- src/lib/pages/FilesPage.svelte | 6 +++++- src/lib/pages/HistoryPage.svelte | 4 +++- src/routes/viewer/+page.svelte | 5 ++++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/lib/pages/DictationPage.svelte b/src/lib/pages/DictationPage.svelte index 50c3a64..653e54e 100644 --- a/src/lib/pages/DictationPage.svelte +++ b/src/lib/pages/DictationPage.svelte @@ -417,7 +417,9 @@ async function finaliseTranscription(audioPath = null) { if (transcript.trim()) { if (settings.autoCopy) { - invoke("copy_to_clipboard", { text: transcript }).catch(() => {}); + navigator.clipboard.writeText(transcript).catch(() => { + invoke("copy_to_clipboard", { text: transcript }).catch(() => {}); + }); } const historyId = crypto.randomUUID(); @@ -464,7 +466,11 @@ } function copyAll() { - if (transcript) invoke("copy_to_clipboard", { text: transcript }).catch(() => {}); + if (transcript) { + navigator.clipboard.writeText(transcript).catch(() => { + invoke("copy_to_clipboard", { text: transcript }).catch(() => {}); + }); + } } function clearTranscript() { diff --git a/src/lib/pages/FilesPage.svelte b/src/lib/pages/FilesPage.svelte index 4a2abb9..03704d3 100644 --- a/src/lib/pages/FilesPage.svelte +++ b/src/lib/pages/FilesPage.svelte @@ -118,7 +118,11 @@ } function copyAll() { - if (fileTranscript) invoke("copy_to_clipboard", { text: fileTranscript }).catch(() => {}); + if (fileTranscript) { + navigator.clipboard.writeText(fileTranscript).catch(() => { + invoke("copy_to_clipboard", { text: fileTranscript }).catch(() => {}); + }); + } } function handleExport(format) { diff --git a/src/lib/pages/HistoryPage.svelte b/src/lib/pages/HistoryPage.svelte index c51bd9a..31d8e97 100644 --- a/src/lib/pages/HistoryPage.svelte +++ b/src/lib/pages/HistoryPage.svelte @@ -178,7 +178,9 @@ } function copyItem(item) { - invoke("copy_to_clipboard", { text: item.text }).catch(() => {}); + navigator.clipboard.writeText(item.text).catch(() => { + invoke("copy_to_clipboard", { text: item.text }).catch(() => {}); + }); } function removeItem(item) { diff --git a/src/routes/viewer/+page.svelte b/src/routes/viewer/+page.svelte index 96b9dc5..831eb00 100644 --- a/src/routes/viewer/+page.svelte +++ b/src/routes/viewer/+page.svelte @@ -194,7 +194,10 @@ function copySegment(idx) { if (item?.segments?.[idx]) { - invoke("copy_to_clipboard", { text: item.segments[idx].text.trim() }).catch(() => {}); + const text = item.segments[idx].text.trim(); + navigator.clipboard.writeText(text).catch(() => { + invoke("copy_to_clipboard", { text }).catch(() => {}); + }); } }