From 7b4076be7e305bacf8c55d75589e841c29d250e1 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 17 Aug 2025 12:22:46 +0800 Subject: Revert "refactor(clip): use Quickshell.execDetached when avaliable" This reverts commit 03e59ad8c7be3c0739b28c9122ecdd79c0b09b55. fix(Clip): quickshell proc not working as expected see https://github.com/quickshell-mirror/quickshell/issues/183 regression introduced in 03e59ad8c7be3c0739b28c9122ecdd79c0b09b55 --- services/Clip.qml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'services') diff --git a/services/Clip.qml b/services/Clip.qml index 59c460b..bd662ca 100644 --- a/services/Clip.qml +++ b/services/Clip.qml @@ -19,6 +19,8 @@ Searchable { property list _clipImgIds: _clipImg.map(p => p.split("/").pop().split(".").shift()) property var _clipMetadata: ({}) + property var toDecode: "" + property string decodedAwaitingForCopy: "" list: { if (!_clipHist?.length) @@ -85,16 +87,25 @@ Searchable { clipMetaStore.adapter.metadata = _clipMetadata; } + onDecodedAwaitingForCopyChanged: { + if (!decodedAwaitingForCopy) + return; + + Quickshell.execDetached(["wl-copy", decodedAwaitingForCopy]); + } + function transformSearch(search) { return search.toLowerCase(); } function decodeAndCopy(text) { - Quickshell.execDetached(["sh", "-c", `cliphist decode ${text} | wl-copy`]); + toDecode = text; + decodeProc.running = true; } function copy(text) { - Quickshell.execDetached(["wl-copy", text]); + decodedAwaitingForCopy = ""; + decodedAwaitingForCopy = text; } function _update() { @@ -135,6 +146,18 @@ Searchable { }); } + Process { + id: decodeProc + running: false + command: ["cliphist", "decode", toDecode] + onExited: { + toDecode = ""; + } + stdout: StdioCollector { + onStreamFinished: decodedAwaitingForCopy = this.data + } + } + Process { id: clipProc running: true -- cgit v1.2.3