fix(clipboard): use navigator.clipboard.writeText as primary, arboard as fallback — fixes silent failure on Linux/XWayland

This commit is contained in:
2026-04-19 10:21:10 +01:00
parent d959a82a4b
commit b479a368e7
4 changed files with 20 additions and 5 deletions

View File

@@ -417,7 +417,9 @@
async function finaliseTranscription(audioPath = null) { async function finaliseTranscription(audioPath = null) {
if (transcript.trim()) { if (transcript.trim()) {
if (settings.autoCopy) { 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(); const historyId = crypto.randomUUID();
@@ -464,7 +466,11 @@
} }
function copyAll() { 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() { function clearTranscript() {

View File

@@ -118,7 +118,11 @@
} }
function copyAll() { 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) { function handleExport(format) {

View File

@@ -178,7 +178,9 @@
} }
function copyItem(item) { 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) { function removeItem(item) {

View File

@@ -194,7 +194,10 @@
function copySegment(idx) { function copySegment(idx) {
if (item?.segments?.[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(() => {});
});
} }
} }