import QtQuick import Quickshell.Io import "." as M Row { id: root spacing: 4 property string status: "off" property string device: "" Process { id: proc running: true command: ["sh", "-c", "bluetoothctl info 2>/dev/null | awk -F': ' '/Name/ {n=$2} /Connected: yes/ {c=1} END {if (c) print n; else print \"\"}'"] stdout: StdioCollector { onStreamFinished: { const t = text.trim(); root.device = t; root.status = t ? "connected" : "on"; } } } Timer { interval: 10000 running: true repeat: true onTriggered: proc.running = true } M.BarIcon { visible: root.status === "connected" icon: "" anchors.verticalCenter: parent.verticalCenter } Text { visible: root.status === "connected" text: root.device color: M.Theme.base05 font.pixelSize: M.Theme.fontSize + 1 font.family: M.Theme.fontFamily anchors.verticalCenter: parent.verticalCenter } }