From 463cb4dd07fa49e972a1aa918839b942f3baabb1 Mon Sep 17 00:00:00 2001 From: rope Date: Tue, 26 May 2026 11:02:35 +0100 Subject: [PATCH] quickshell: network widget, bar transparency, drop nm-applet Co-Authored-By: Claude Opus 4.6 --- settings/hyprland.nix | 65 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index 172fd5d..5619e1e 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -240,7 +240,7 @@ in -- dbus-update-activation-environment chain fails upstream. hl.exec_cmd("systemctl --user start hyprland-session.target") hl.exec_cmd("mako") - hl.exec_cmd("nm-applet --indicator") + ${lib.optionalString isMacbook ''hl.exec_cmd("nm-applet --indicator")''} hl.exec_cmd("wl-paste --type text --watch cliphist store") hl.exec_cmd("wl-paste --type image --watch cliphist store") hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24") @@ -568,6 +568,7 @@ in import Quickshell.Hyprland import Quickshell.Services.SystemTray import Quickshell.Widgets + import Quickshell.Io import QtQuick import QtQuick.Layouts import Qt5Compat.GraphicalEffects @@ -588,7 +589,7 @@ in } implicitHeight: 30 - color: "#${c.base00}" + color: "#D1${c.base00}" RowLayout { anchors.fill: parent @@ -636,6 +637,66 @@ in // Spacer Item { Layout.fillWidth: true } + // Network status + Item { + Layout.preferredHeight: 30 + Layout.preferredWidth: netRow.width + Layout.rightMargin: 10 + + property string netState: "" + property string netConn: "" + property string netIcon: "\u{f0b1}" + + Timer { + interval: 5000 + running: true + repeat: true + triggeredOnStart: true + onTriggered: netProc.running = true + } + + Process { + id: netProc + command: ["${pkgs.networkmanager}/bin/nmcli", "-t", "-f", "DEVICE,TYPE,STATE,CONNECTION", "device"] + stdout: SplitParser { + onRead: data => { + let fields = data.split(":"); + if (fields.length >= 4 && fields[1] === "ethernet") { + let state = fields[2]; + let conn = fields[3]; + if (state === "connected") { + parent.parent.netState = "connected"; + parent.parent.netConn = conn; + parent.parent.netIcon = "\u{f0200}"; + } else { + parent.parent.netState = "disconnected"; + parent.parent.netConn = ""; + parent.parent.netIcon = "\u{f0201}"; + } + } + } + } + } + + RowLayout { + id: netRow + anchors.verticalCenter: parent.verticalCenter + spacing: 6 + + Text { + text: parent.parent.netIcon + color: "#${c.base05}" + font.family: "FiraMono Nerd Font" + font.pixelSize: 14 + } + } + + MouseArea { + anchors.fill: parent + onClicked: Qt.openUrlExternally("nm-connection-editor") + } + } + // Tray icons inline RowLayout { id: trayArea