import QtQuick import Quickshell.Io import "." as M Row { id: root spacing: 4 property string ifname: "" property string essid: "" property string state: "disconnected" Process { id: proc running: true command: ["sh", "-c", "nmcli -t -f NAME,TYPE,DEVICE connection show --active | head -1"] stdout: StdioCollector { onStreamFinished: { const line = text.trim(); if (!line) { root.state = "disconnected"; root.essid = ""; root.ifname = ""; return; } const parts = line.split(":"); root.essid = parts[0] || ""; root.ifname = parts[2] || ""; root.state = (parts[1] || "").includes("wireless") ? "wifi" : "eth"; } } } Timer { interval: 5000 running: true repeat: true onTriggered: proc.running = true } Text { text: { if (root.state === "wifi") return " " + root.essid; if (root.state === "eth") return "󰈀"; return "󰣽"; } color: M.Theme.base05 font.pixelSize: M.Theme.fontSize + 1 font.family: M.Theme.fontFamily anchors.verticalCenter: parent.verticalCenter } }