aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/network/NetworkTile.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-14 18:13:11 +0200
committerDanilo M. <danix@danix.xyz>2026-09-14 18:13:11 +0200
commit26e6f28b15a8f2ed7664c5c268b4065ae62668d0 (patch)
tree62f087b0047652f70e362606f3c0925099190204 /desktop/modules/network/NetworkTile.qml
parent4eaf3bdce7b4e7663c6ba5c206d68eacbd24949e (diff)
downloadquickshell-26e6f28b15a8f2ed7664c5c268b4065ae62668d0.tar.gz
quickshell-26e6f28b15a8f2ed7664c5c268b4065ae62668d0.zip
feat(desktop): globe network tile with per-link IPs
Diffstat (limited to 'desktop/modules/network/NetworkTile.qml')
-rw-r--r--desktop/modules/network/NetworkTile.qml70
1 files changed, 50 insertions, 20 deletions
diff --git a/desktop/modules/network/NetworkTile.qml b/desktop/modules/network/NetworkTile.qml
index a9e5dd0..d88ad35 100644
--- a/desktop/modules/network/NetworkTile.qml
+++ b/desktop/modules/network/NetworkTile.qml
@@ -12,38 +12,68 @@
import QtQuick
import "../.."
-// The state line under the tile label. One line per active link: the API
-// exposes no route metric, so when both wired and wifi are up the tile shows
-// both rather than guessing which one carries traffic.
+// The state line under the tile label: a green dot, the link's name, and its
+// local IP. One row per active link, because the API exposes no route metric
+// and the tile will not guess which link carries traffic.
Column {
+ id: tile
+
required property var net
width: parent ? parent.width : implicitWidth
spacing: 2
- Text {
- width: parent.width
- elide: Text.ElideRight
- visible: net.wiredUp
- text: net.wiredName
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
- color: Theme.text
+ Row {
+ visible: tile.net.wiredUp
+ width: tile.width
+ spacing: 5
+
+ Rectangle {
+ anchors.verticalCenter: parent.verticalCenter
+ width: 7; height: 7; radius: 4
+ color: Theme.green
+ }
+
+ Text {
+ width: parent.width - 12
+ elide: Text.ElideRight
+ text: {
+ const ip = tile.net.ipFor(tile.net.wiredName);
+ return tile.net.wiredName + (ip !== "" ? " " + ip : "");
+ }
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ color: Theme.text
+ }
}
- Text {
- width: parent.width
- elide: Text.ElideRight
- visible: net.wifiUp
- text: net.wifiSsid
- font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
- color: Theme.text
+ Row {
+ visible: tile.net.wifiUp
+ width: tile.width
+ spacing: 5
+
+ Rectangle {
+ anchors.verticalCenter: parent.verticalCenter
+ width: 7; height: 7; radius: 4
+ color: Theme.green
+ }
+
+ Text {
+ width: parent.width - 12
+ elide: Text.ElideRight
+ text: {
+ const ip = tile.net.ipFor(tile.net.wifiDevice ? tile.net.wifiDevice.name : "");
+ return tile.net.wifiSsid + (ip !== "" ? " " + ip : "");
+ }
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ color: Theme.text
+ }
}
Text {
- width: parent.width
+ width: tile.width
elide: Text.ElideRight
- visible: !net.wiredUp && !net.wifiUp
- text: net.wifiOn ? "Disconnected" : "Off"
+ visible: !tile.net.wiredUp && !tile.net.wifiUp
+ text: tile.net.wifiOn ? "Disconnected" : "Off"
font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
color: Theme.subtext
}