diff options
| author | Craig Jennings <c@cjennings.net> | 2026-03-07 13:00:34 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-03-07 13:00:34 -0600 |
| commit | f6a539677ef9ab98c25220174c2162ca375d15d0 (patch) | |
| tree | f40fd83972acd898bc26dab7612f296882e713ba /dotfiles/hyprland/.local/bin/waybar-netspeed | |
| parent | d1f84e5c3aa6fa9961c761822a56a0d274fc6711 (diff) | |
fix: update layout-resize and waybar-netspeed for 0.54
layout-resize: replace removed splitratio dispatcher with layoutmsg
mfact for master layout resizing.
waybar-netspeed: replace iwgetid/proc/net/wireless with iw commands
for SSID and signal strength (old tools no longer populated by kernel).
Diffstat (limited to 'dotfiles/hyprland/.local/bin/waybar-netspeed')
| -rwxr-xr-x | dotfiles/hyprland/.local/bin/waybar-netspeed | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/dotfiles/hyprland/.local/bin/waybar-netspeed b/dotfiles/hyprland/.local/bin/waybar-netspeed index a6296b0..c285ac5 100755 --- a/dotfiles/hyprland/.local/bin/waybar-netspeed +++ b/dotfiles/hyprland/.local/bin/waybar-netspeed @@ -39,22 +39,25 @@ DOWN=$(format_speed $RX_RATE) # Determine connection type and get appropriate icon/label if [ -d "/sys/class/net/$INTERFACE/wireless" ]; then # WiFi connection - LABEL=$(iwgetid -r 2>/dev/null || echo "WiFi") + LABEL=$(iw dev "$INTERFACE" info 2>/dev/null | awk '/ssid/ {print $2}') + [ -z "$LABEL" ] && LABEL="WiFi" - # Get signal strength in percentage - SIGNAL=$(awk 'NR==3 {print int($3 * 100 / 70)}' /proc/net/wireless 2>/dev/null) + # Get signal strength in dBm + SIGNAL_DBM=$(iw dev "$INTERFACE" link 2>/dev/null | awk '/signal:/ {print $2}') - # Select icon based on signal strength - if [ -z "$SIGNAL" ] || [ "$SIGNAL" -le 0 ]; then + # Select icon based on signal dBm + if [ -z "$SIGNAL_DBM" ]; then ICON="" # No signal - elif [ "$SIGNAL" -le 25 ]; then - ICON="" # Weak - elif [ "$SIGNAL" -le 50 ]; then - ICON="" # Fair - elif [ "$SIGNAL" -le 75 ]; then + elif [ "$SIGNAL_DBM" -ge -50 ]; then + ICON="" # Excellent + elif [ "$SIGNAL_DBM" -ge -60 ]; then ICON="" # Good + elif [ "$SIGNAL_DBM" -ge -70 ]; then + ICON="" # Fair + elif [ "$SIGNAL_DBM" -ge -80 ]; then + ICON="" # Weak else - ICON="" # Excellent + ICON="" # No signal fi else # Ethernet connection @@ -64,4 +67,4 @@ fi TOOLTIP="Up: $UP\nDown: $DOWN" -echo "{\"text\": \"<span size='large'>$ICON</span> $LABEL\", \"tooltip\": \"$TOOLTIP\", \"class\": \"connected\"}" +echo "{\"text\": \"<span size='large'>$ICON</span> $LABEL\", \"tooltip\": \"$TOOLTIP\", \"class\": \"connected\"}" |
