quickshell: network widget, bar transparency, drop nm-applet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 11:02:35 +01:00
parent f1f33194b2
commit 463cb4dd07

View file

@ -240,7 +240,7 @@ in
-- dbus-update-activation-environment chain fails upstream. -- dbus-update-activation-environment chain fails upstream.
hl.exec_cmd("systemctl --user start hyprland-session.target") hl.exec_cmd("systemctl --user start hyprland-session.target")
hl.exec_cmd("mako") 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 text --watch cliphist store")
hl.exec_cmd("wl-paste --type image --watch cliphist store") hl.exec_cmd("wl-paste --type image --watch cliphist store")
hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24") hl.exec_cmd("hyprctl setcursor Bibata-Modern-Ice 24")
@ -568,6 +568,7 @@ in
import Quickshell.Hyprland import Quickshell.Hyprland
import Quickshell.Services.SystemTray import Quickshell.Services.SystemTray
import Quickshell.Widgets import Quickshell.Widgets
import Quickshell.Io
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import Qt5Compat.GraphicalEffects import Qt5Compat.GraphicalEffects
@ -588,7 +589,7 @@ in
} }
implicitHeight: 30 implicitHeight: 30
color: "#${c.base00}" color: "#D1${c.base00}"
RowLayout { RowLayout {
anchors.fill: parent anchors.fill: parent
@ -636,6 +637,66 @@ in
// Spacer // Spacer
Item { Layout.fillWidth: true } 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 // Tray icons inline
RowLayout { RowLayout {
id: trayArea id: trayArea