clipboard: prevent restart spin loop of watchers. Fix #1954

This commit is contained in:
Lemmy
2026-02-24 09:09:17 -05:00
parent f7c156a509
commit c13db3635c
+24 -8
View File
@@ -251,27 +251,43 @@ Singleton {
id: watchText id: watchText
stdout: StdioCollector {} stdout: StdioCollector {}
onExited: (exitCode, exitStatus) => { onExited: (exitCode, exitStatus) => {
if (root.autoWatch && root.watchersStarted) { if (root.autoWatch && root.watchersStarted && Settings.data.appLauncher.clipboardWatchTextCommand.trim() !== "") {
Qt.callLater(() => { watchTextRestartTimer.restart();
watchText.running = true;
});
} }
} }
} }
Timer {
id: watchTextRestartTimer
interval: 1000
repeat: false
onTriggered: {
if (root.autoWatch && root.watchersStarted)
watchText.running = true;
}
}
// Image watcher // Image watcher
Process { Process {
id: watchImage id: watchImage
stdout: StdioCollector {} stdout: StdioCollector {}
onExited: (exitCode, exitStatus) => { onExited: (exitCode, exitStatus) => {
if (root.autoWatch && root.watchersStarted) { if (root.autoWatch && root.watchersStarted && Settings.data.appLauncher.clipboardWatchImageCommand.trim() !== "") {
Qt.callLater(() => { watchImageRestartTimer.restart();
watchImage.running = true;
});
} }
} }
} }
Timer {
id: watchImageRestartTimer
interval: 1000
repeat: false
onTriggered: {
if (root.autoWatch && root.watchersStarted)
watchImage.running = true;
}
}
// Capture current clipboard text when needed // Capture current clipboard text when needed
Process { Process {
id: captureTextProc id: captureTextProc