Compare commits
3 commits
450f24528c
...
3c9f6e78cc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c9f6e78cc | ||
|
|
bf46b0f277 | ||
|
|
44dde3d034 |
3 changed files with 46 additions and 32 deletions
|
|
@ -30,34 +30,40 @@ PanelWindow {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: 8
|
anchors.leftMargin: 8
|
||||||
anchors.rightMargin: 8
|
anchors.rightMargin: 8
|
||||||
spacing: 8
|
spacing: 0
|
||||||
|
|
||||||
// ---- left ----
|
// ---- left ----
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignLeft
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
// M.Workspaces {}
|
// M.Workspaces {}
|
||||||
M.Tray { bar: bar }
|
M.Tray { bar: bar }
|
||||||
M.WindowTitle { Layout.maximumWidth: 400 }
|
M.WindowTitle { Layout.maximumWidth: 400 }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
|
|
||||||
// ---- center ----
|
// ---- center ----
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
M.Clock {}
|
M.Clock {}
|
||||||
M.Notifications {}
|
M.Notifications {}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { Layout.fillWidth: true }
|
|
||||||
|
|
||||||
// ---- right ----
|
// ---- right ----
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.alignment: Qt.AlignRight
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
M.Mpris {}
|
M.Mpris {}
|
||||||
|
|
@ -76,4 +82,5 @@ PanelWindow {
|
||||||
M.Wlogout {}
|
M.Wlogout {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ Row {
|
||||||
Process {
|
Process {
|
||||||
id: proc
|
id: proc
|
||||||
running: true
|
running: true
|
||||||
command: ["sh", "-c", "nmcli -t -f NAME,TYPE,DEVICE connection show --active | head -1"]
|
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"]
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
const line = text.trim();
|
const line = text.trim();
|
||||||
|
|
@ -26,7 +26,9 @@ Row {
|
||||||
const parts = line.split(":");
|
const parts = line.split(":");
|
||||||
root.essid = parts[0] || "";
|
root.essid = parts[0] || "";
|
||||||
root.ifname = parts[2] || "";
|
root.ifname = parts[2] || "";
|
||||||
root.state = (parts[1] || "").includes("wireless") ? "wifi" : "eth";
|
if ((parts[1] || "").includes("wireless")) root.state = "wifi";
|
||||||
|
else if (parts[0] === "linked") root.state = "linked";
|
||||||
|
else root.state = "eth";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,6 +43,7 @@ Row {
|
||||||
text: {
|
text: {
|
||||||
if (root.state === "wifi") return " " + root.essid;
|
if (root.state === "wifi") return " " + root.essid;
|
||||||
if (root.state === "eth") return "";
|
if (root.state === "eth") return "";
|
||||||
|
if (root.state === "linked") return "";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
color: M.Theme.base05
|
color: M.Theme.base05
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ Row {
|
||||||
|
|
||||||
property int count: 0
|
property int count: 0
|
||||||
property bool dnd: false
|
property bool dnd: false
|
||||||
|
property bool inhibited: false
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: sub
|
id: sub
|
||||||
|
|
@ -18,8 +19,10 @@ Row {
|
||||||
onRead: (line) => {
|
onRead: (line) => {
|
||||||
try {
|
try {
|
||||||
const d = JSON.parse(line);
|
const d = JSON.parse(line);
|
||||||
|
const cls = d.class ?? "";
|
||||||
root.count = d.count ?? 0;
|
root.count = d.count ?? 0;
|
||||||
root.dnd = (d.class ?? "").includes("dnd");
|
root.dnd = cls.includes("dnd");
|
||||||
|
root.inhibited = cls.includes("inhibited");
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -27,6 +30,7 @@ Row {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: {
|
text: {
|
||||||
|
if (root.inhibited) return root.count > 0 ? "" : "";
|
||||||
if (root.dnd) return root.count > 0 ? "" : "";
|
if (root.dnd) return root.count > 0 ? "" : "";
|
||||||
return root.count > 0 ? "" : "";
|
return root.count > 0 ? "" : "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue