summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-08-17 12:22:46 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-08-17 12:34:07 +0800
commit7b4076be7e305bacf8c55d75589e841c29d250e1 (patch)
treedd546b267bc202f83831bd682aa3c31d3add25b4 /services
parent873629a42815712b2559ee0e8e5c4ce4e7612dd6 (diff)
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
Diffstat (limited to 'services')
-rw-r--r--services/Clip.qml27
1 files changed, 25 insertions, 2 deletions
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<string> _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() {
@@ -136,6 +147,18 @@ 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"]