diff options
| -rw-r--r-- | dot_config/waybar/config.jsonc | 31 | ||||
| -rw-r--r-- | dot_config/waybar/executable_wg-status.sh | 13 | ||||
| -rw-r--r-- | dot_config/waybar/style.css | 43 |
3 files changed, 78 insertions, 9 deletions
diff --git a/dot_config/waybar/config.jsonc b/dot_config/waybar/config.jsonc index fc2fb38..9368e04 100644 --- a/dot_config/waybar/config.jsonc +++ b/dot_config/waybar/config.jsonc @@ -8,9 +8,11 @@ "modules-right": [ "pulseaudio", "cpu", - "custom/memory", "temperature", - "network", + "custom/memory", + "network#wifi", + "network#bond", + "custom/wg", "battery", "clock", "tray", @@ -41,13 +43,26 @@ "critical-threshold": 80, }, - "network": { + "network#wifi": { + "interface": "wlp*", + "interval": 10, + "format-wifi": "{essid} {signalStrength}%", + "format-disconnected": "wifi off", + "tooltip-format-wifi": "{essid} · {signalStrength}% · {frequency} MHz\n{ifname}", + }, + + "network#bond": { + "interface": "bond0", + "interval": 5, + "format": "↓{bandwidthDownBits} ↑{bandwidthUpBits}", + "format-disconnected": "bond off", + "tooltip-format": "{ifname}: {ipaddr}/{cidr}", + }, + + "custom/wg": { + "exec": "~/.config/waybar/wg-status.sh", + "return-type": "json", "interval": 10, - "format-wifi": "{essid} {signalStrength}% ↓{bandwidthDownBits} ↑{bandwidthUpBits}", - "format-ethernet": "↓{bandwidthDownBits} ↑{bandwidthUpBits}", - "format-disconnected": "disconnected", - "tooltip-format-wifi": "{essid} ({signalStrength}%) · {frequency} MHz\n{ifname}: {ipaddr}/{cidr}", - "tooltip-format-ethernet": "{ifname}: {ipaddr}/{cidr}", }, "battery": { diff --git a/dot_config/waybar/executable_wg-status.sh b/dot_config/waybar/executable_wg-status.sh new file mode 100644 index 0000000..1fd7241 --- /dev/null +++ b/dot_config/waybar/executable_wg-status.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Emit waybar JSON describing wireguard status. Uses `ip` (no root needed). +set -eu + +iface=$(ip -br link show type wireguard 2>/dev/null | awk 'NF{print $1; exit}') + +if [ -n "${iface:-}" ]; then + printf '{"text":"WG %s","class":"up","tooltip":"%s"}\n' \ + "$iface" \ + "$(ip -br -4 addr show dev "$iface" 2>/dev/null | awk '{for(i=3;i<=NF;i++)printf "%s ",$i}')" +else + printf '{"text":"WG off","class":"down","tooltip":"no wireguard interface"}\n' +fi diff --git a/dot_config/waybar/style.css b/dot_config/waybar/style.css index 8e1299d..6038a87 100644 --- a/dot_config/waybar/style.css +++ b/dot_config/waybar/style.css @@ -41,10 +41,51 @@ window#waybar { #network, #pulseaudio, #tray, -#custom-memory { +#custom-memory, +#custom-wg { padding: 0 6px; } +#cpu { + color: #83a598; /* blue */ +} + +#custom-memory { + color: #8ec07c; /* aqua */ +} + +#temperature { + color: #fe8019; /* orange */ +} + +#network.wifi { + color: #b8bb26; /* green */ +} + +#network.bond { + color: #d3869b; /* purple */ +} + +#custom-wg.up { + color: #d3869b; /* purple */ +} + +#custom-wg.down { + color: #928374; /* gray */ +} + +#battery { + color: #fabd2f; /* yellow */ +} + +#pulseaudio { + color: #fe8019; /* orange */ +} + +#clock { + color: #ebdbb2; /* fg */ +} + #battery.warning { color: #fabd2f; } |
