From d8bd3c6c30cb02543960b5bc7cb2236202d93895 Mon Sep 17 00:00:00 2001 From: vybe Date: Mon, 18 May 2026 05:08:15 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20auto-detect=20clipboard=20tool=20at=20s?= =?UTF-8?q?tartup=20(#6)\n\n-=20Priority:=20dms=20cl=20copy=20=E2=86=92=20?= =?UTF-8?q?wl-copy=20=E2=86=92=20clipmanctl=20copy=20=E2=86=92=20none\n-?= =?UTF-8?q?=20Show=20error=20toast=20if=20no=20clipboard=20tool=20is=20fou?= =?UTF-8?q?nd\n-=20statusCheck=20runs=20after=20clipboard=20detection=20co?= =?UTF-8?q?mpletes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tailscalectl/TailscaleWidget.qml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tailscalectl/TailscaleWidget.qml b/tailscalectl/TailscaleWidget.qml index da6b6ca..aec7a31 100644 --- a/tailscalectl/TailscaleWidget.qml +++ b/tailscalectl/TailscaleWidget.qml @@ -13,6 +13,7 @@ PluginComponent { property string tailscaleIP: "" property string currentExitNode: "" property var peers: [] + property string clipboardCmd: "" layerNamespacePlugin: "tailscalectl" popoutWidth: 360 @@ -25,7 +26,9 @@ PluginComponent { onTriggered: statusCheck.running = true } - Component.onCompleted: statusCheck.running = true + Component.onCompleted: { + detectClipboard.running = true + } Process { id: toggleProcess @@ -39,6 +42,22 @@ PluginComponent { id: copyProcess } + Process { + id: detectClipboard + + command: ["sh", "-c", "which dms >/dev/null 2>&1 && echo 'dms cl copy' || which wl-copy >/dev/null 2>&1 && echo 'wl-copy' || which clipmanctl >/dev/null 2>&1 && echo 'clipmanctl copy' || echo none"] + + stdout: StdioCollector { + onStreamFinished: { + root.clipboardCmd = this.text.trim() + } + } + + onExited: (code, status) => { + statusCheck.running = true + } + } + Process { id: statusCheck @@ -89,7 +108,11 @@ PluginComponent { } function copyToClipboard(text) { - copyProcess.command = ["sh", "-c", "printf '%s' '" + text.replace(/'/g, "'\\''") + "' | wl-copy"] + if (!root.clipboardCmd || root.clipboardCmd === "none") { + ToastService.showError("tailscalectl", "No clipboard tool found") + return + } + copyProcess.command = ["sh", "-c", "printf '%s' '" + text.replace(/'/g, "'\\''") + "' | " + root.clipboardCmd] copyProcess.running = true ToastService.showInfo("tailscalectl", "Copied: " + text) }