Files
nixconfig/modules/home/wayland/apps/eww/bar/modules/net.yuck
T
2026-09-10 21:02:27 +02:00

36 lines
1.5 KiB
Plaintext

(deflisten net
:initial '{"wifi":{"connected":false,"enabled":false,"icon":"󰤮","ssid":"","ip":"","freq":0,"band":"","gen":"","signal":0},"ethernet":{"connected":false,"interface":"","ip":"","speed":""},"usb":{"connected":false,"interface":"","ip":""},"wireguard":[],"vpn":{"up":false,"name":""}}'
"scripts/net/net")
(deflisten bt
:initial '{"powered":false,"connected":false,"device":"","devices":[]}'
"scripts/net/bt")
(defwidget net-mod []
(module
(eventbox
:onclick "scripts/panel-toggle net"
(box :orientation "v"
(label
:class "net-icon ${net.ethernet.connected ? 'net-active' : 'net-dim'}"
:tooltip {net.ethernet.connected ? "Ethernet: Connected" : "Ethernet: Disconnected"}
:text "󰈀")
(label
:visible {net.usb.connected}
:class "net-icon net-active"
:tooltip "USB: Connected"
:text "󰌷")
(label
:visible {net.vpn.up}
:class "net-icon net-active"
:tooltip "VPN: ${net.vpn.name}"
:text "󰖂")
(label
:class "net-icon ${net.wifi.connected ? 'net-active' : 'net-dim'}"
:tooltip {net.wifi.connected ? "WiFi: ${net.wifi.ssid}" : "WiFi: Disconnected"}
:text {net.wifi.icon})
(label
:class "net-icon ${bt.connected ? 'blt-connected' : bt.powered ? 'blt-on' : 'net-dim'}"
:tooltip {bt.connected ? "Bluetooth: ${bt.device}" : bt.powered ? "Bluetooth: On" : "Bluetooth: Off"}
:text {bt.connected ? "󰂱" : bt.powered ? "󰂯" : "󰂲"})))))