diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-17 13:04:40 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-18 00:44:22 +0800 |
| commit | 1078ef324f8e83a4390fcc5e565119dff9228c8c (patch) | |
| tree | 668ac8859dbeb7ea8ce2a4330a38bcaf5c228304 /services | |
| parent | f23ced82012a9f85739210aa333cd6f92815c50a (diff) | |
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
Diffstat (limited to 'services')
| -rw-r--r-- | services/Clip.qml | 28 |
1 files changed, 3 insertions, 25 deletions
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<string> _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() { @@ -148,18 +138,6 @@ Searchable { } Process { - id: decodeProc - running: false - command: ["cliphist", "decode", toDecode] - onExited: { - toDecode = ""; - } - stdout: StdioCollector { - onStreamFinished: decodedAwaitingForCopy = this.data - } - } - - Process { id: clipProc running: true command: ["cliphist", "-preview-width", 9 ** 9, "-max-items", 9 ** 9, "list"] |
