This commit is contained in:
2026-04-19 18:05:23 +01:00
parent 801c9d74d0
commit aac7c9de0a
41 changed files with 665 additions and 142 deletions
+1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
pkill waybar || waybar &
pkill swaync || swaync &
+18 -4
View File
@@ -5,9 +5,9 @@
# -f: Specific fields
ACTIVE_CONN=$(nmcli -t -f NAME,TYPE connection show --active | grep -E '802-3-ethernet|802-11-wireless' | head -n 1)
# If no connection is found, output nothing
# If no connection is found, output disconnected icon
if [ -z "$ACTIVE_CONN" ]; then
echo ""
echo "{\"text\": \"󰤭 \", \"class\": \"disconnected\"}"
exit 0
fi
@@ -18,8 +18,22 @@ CONN_TYPE="${ACTIVE_CONN##*:}"
# Output JSON for Waybar custom module
if [[ "$CONN_TYPE" == *"802-11-wireless"* ]]; then
# It's Wi-Fi
echo "{\"text\": \"$CONN_NAME \", \"class\": \"wifi\"}"
SIGNAL=$(nmcli -t -f IN-USE,SIGNAL dev wifi | grep '^\*' | cut -d':' -f2)
if [ -z "$SIGNAL" ]; then
ICON="󰤟"
elif [ "$SIGNAL" -ge 80 ]; then
ICON="󰤨"
elif [ "$SIGNAL" -ge 60 ]; then
ICON="󰤥"
elif [ "$SIGNAL" -ge 40 ]; then
ICON="󰤢"
elif [ "$SIGNAL" -ge 20 ]; then
ICON="󰤟"
else
ICON="󰤯"
fi
echo "{\"text\": \"$CONN_NAME $ICON \", \"class\": \"wifi\"}"
else
# It's Ethernet
echo "{\"text\": \"$CONN_NAME 󰊗\", \"class\": \"ethernet\"}"
echo "{\"text\": \"$CONN_NAME 󰈀 \", \"class\": \"ethernet\"}"
fi