1
0
Fork 0
This commit is contained in:
Luca Bilke 2023-02-14 13:53:15 +01:00
commit 2c68eb16b4
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# battery status file is sent in as an argument from sb-battery # battery status file is sent in as an argument from sb-battery
while inotifywait -e modify "$1/status"; do # while inotifywait -e modify "$1/status"; do
pkill -RTMIN+3 dwmblocks || break # pkill -RTMIN+3 dwmblocks || break
done # done

View File

@ -4,7 +4,7 @@ shift=""
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
for w in /sys/class/net/w*/; do for w in /sys/class/net/w*/; do
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w/operstate)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")" percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w/operstate)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w/operstate | tr -d "[:space:]")" grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/;s/dormant/睊/" $w/operstate | tr -d "[:space:]")"
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent" printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
shift=" " shift=" "
done done