diff --git a/modules/Bar.qml b/modules/Bar.qml index 443e807..345184b 100644 --- a/modules/Bar.qml +++ b/modules/Bar.qml @@ -30,57 +30,50 @@ PanelWindow { anchors.fill: parent anchors.leftMargin: 8 anchors.rightMargin: 8 - spacing: 0 + spacing: 8 // ---- left ---- - Item { - Layout.fillWidth: true - Layout.fillHeight: true + RowLayout { + Layout.alignment: Qt.AlignLeft + spacing: 8 - RowLayout { - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - spacing: 8 - - // M.Workspaces {} - M.Tray { bar: bar } - M.WindowTitle { Layout.maximumWidth: 400 } - } + // M.Workspaces {} + M.Tray { bar: bar } + M.WindowTitle { Layout.maximumWidth: 400 } } + Item { Layout.fillWidth: true } + // ---- center ---- RowLayout { + Layout.alignment: Qt.AlignHCenter spacing: 8 M.Clock {} M.Notifications {} } + Item { Layout.fillWidth: true } + // ---- right ---- - Item { - Layout.fillWidth: true - Layout.fillHeight: true + RowLayout { + Layout.alignment: Qt.AlignRight + spacing: 12 - RowLayout { - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - spacing: 12 - - M.Mpris {} - M.Volume {} - M.Bluetooth {} - M.Backlight {} - M.Network {} - M.PowerProfile {} - M.IdleInhibitor {} - M.Weather {} - M.Temperature {} - M.Cpu {} - M.Memory {} - M.Disk {} - M.Battery {} - M.Wlogout {} - } + M.Mpris {} + M.Volume {} + M.Bluetooth {} + M.Backlight {} + M.Network {} + M.PowerProfile {} + M.IdleInhibitor {} + M.Weather {} + M.Temperature {} + M.Cpu {} + M.Memory {} + M.Disk {} + M.Battery {} + M.Wlogout {} } } } diff --git a/modules/Network.qml b/modules/Network.qml index 60c1add..3950a1d 100644 --- a/modules/Network.qml +++ b/modules/Network.qml @@ -13,7 +13,7 @@ Row { Process { id: proc running: true - command: ["sh", "-c", "line=$(nmcli -t -f NAME,TYPE,DEVICE connection show --active 2>/dev/null | head -1); if [ -n \"$line\" ]; then echo \"$line\"; else dev=$(nmcli -t -f DEVICE,STATE device 2>/dev/null | grep ':connected' | grep -v ':unmanaged\\|:unavailable\\|:disconnected\\|:connecting' | head -1 | cut -d: -f1); if [ -n \"$dev\" ]; then echo \"linked:linked:$dev\"; fi; fi"] + command: ["sh", "-c", "nmcli -t -f NAME,TYPE,DEVICE connection show --active | head -1"] stdout: StdioCollector { onStreamFinished: { const line = text.trim(); @@ -26,9 +26,7 @@ Row { const parts = line.split(":"); root.essid = parts[0] || ""; root.ifname = parts[2] || ""; - if ((parts[1] || "").includes("wireless")) root.state = "wifi"; - else if (parts[0] === "linked") root.state = "linked"; - else root.state = "eth"; + root.state = (parts[1] || "").includes("wireless") ? "wifi" : "eth"; } } } @@ -43,7 +41,6 @@ Row { text: { if (root.state === "wifi") return " " + root.essid; if (root.state === "eth") return "󰈀"; - if (root.state === "linked") return "󱘖"; return "󰣽"; } color: M.Theme.base05 diff --git a/modules/Notifications.qml b/modules/Notifications.qml index 85b96f1..2342d1c 100644 --- a/modules/Notifications.qml +++ b/modules/Notifications.qml @@ -8,7 +8,6 @@ Row { property int count: 0 property bool dnd: false - property bool inhibited: false Process { id: sub @@ -19,10 +18,8 @@ Row { onRead: (line) => { try { const d = JSON.parse(line); - const cls = d.class ?? ""; root.count = d.count ?? 0; - root.dnd = cls.includes("dnd"); - root.inhibited = cls.includes("inhibited"); + root.dnd = (d.class ?? "").includes("dnd"); } catch (e) {} } } @@ -30,7 +27,6 @@ Row { Text { text: { - if (root.inhibited) return root.count > 0 ? "󰂛" : "󰪑"; if (root.dnd) return root.count > 0 ? "󰂠" : "󰪓"; return root.count > 0 ? "󱅫" : "󰂜"; }