From 1078ef324f8e83a4390fcc5e565119dff9228c8c Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 17 Aug 2025 13:04:40 +0800 Subject: Reapply "refactor(clip): use Quickshell.execDetached when avaliable" This reverts commit 7b4076be7e305bacf8c55d75589e841c29d250e1. fix(Clip): sh escaping args from user data chore: migrate mpris stringutils to actual stringutils StringUtils is copied from end4-dots, GPL Licensed This also fixes image not being copied properly --- services/Clip.qml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) (limited to 'services') diff --git a/services/Clip.qml b/services/Clip.qml index 5feb1fb..622b293 100644 --- a/services/Clip.qml +++ b/services/Clip.qml @@ -7,6 +7,7 @@ import Quickshell.Wayland import qs.components import qs.utils import qs.services +import "../utils/string_utils.js" as StringUtils Searchable { id: root @@ -19,8 +20,6 @@ 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) @@ -88,25 +87,16 @@ Searchable { clipMetaStore.adapter.metadata = _clipMetadata; } - onDecodedAwaitingForCopyChanged: { - if (!decodedAwaitingForCopy) - return; - - Quickshell.execDetached(["wl-copy", decodedAwaitingForCopy]); - } - function transformSearch(search) { return search.toLowerCase(); } function decodeAndCopy(text) { - toDecode = text; - decodeProc.running = true; + Quickshell.execDetached(["sh", "-c", `cliphist decode '${StringUtils.shellSingleQuoteEscape(text)}' | wl-copy`]); } function copy(text) { - decodedAwaitingForCopy = ""; - decodedAwaitingForCopy = text; + Quickshell.execDetached(["wl-copy", text]); } function _update() { @@ -147,18 +137,6 @@ 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