diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-14 19:42:14 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-14 19:42:14 +0200 |
| commit | 1c2da6975fead84cf3e8e23356d9e364c08ee467 (patch) | |
| tree | 99d955c3ec54cc222ea33c5519ae77f6752f7d7f /desktop/modules/kdeconnect/KdeConnectModule.qml | |
| parent | 7304e3dd96f0bae4d63ccf3d4fa4f176b760a81f (diff) | |
| download | quickshell-1c2da6975fead84cf3e8e23356d9e364c08ee467.tar.gz quickshell-1c2da6975fead84cf3e8e23356d9e364c08ee467.zip | |
fix(desktop): queue KDE Connect actions instead of interrupting
A second action while one was in flight killed the first process, whose
onExited then fired under the new label and raised a false failure
notification. Actions are now queued and launched on exit, so each exit
reports under its own label. Also correct two comments that contradicted
the code: the pairing banner is only noticed on the on-open poll, and the
laptop glyph keys off the daemon's desktop type.
Diffstat (limited to 'desktop/modules/kdeconnect/KdeConnectModule.qml')
| -rw-r--r-- | desktop/modules/kdeconnect/KdeConnectModule.qml | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/desktop/modules/kdeconnect/KdeConnectModule.qml b/desktop/modules/kdeconnect/KdeConnectModule.qml index b7392b0..fa4fb52 100644 --- a/desktop/modules/kdeconnect/KdeConnectModule.qml +++ b/desktop/modules/kdeconnect/KdeConnectModule.qml @@ -103,12 +103,24 @@ Module { property Process notifyProc: Process {} - // One reusable action process. Actions are serialized; a second click - // while one runs replaces it rather than racing. A failure notifies. + // One reusable action process. Actions never interrupt one another: a + // second action while one runs is queued until the first exits, so each + // exit is reported under the label it was started with. Killing an + // in-flight process to start a new one would fire onExited with the new + // label and raise a false failure. + property var queuedAction: null + function run(label, cmd) { + if (actProc.running) { + queuedAction = { label: label, cmd: cmd }; + return; + } + launch(label, cmd); + } + + function launch(label, cmd) { actProc.label = label; actProc.command = cmd; - actProc.running = false; actProc.running = true; } @@ -120,6 +132,11 @@ Module { mod.notify(actProc.label + " failed", actErr.text.trim() || ("exited " + code)); mod.refresh(); + if (mod.queuedAction !== null) { + const q = mod.queuedAction; + mod.queuedAction = null; + mod.launch(q.label, q.cmd); + } } } |
