dwmblocks: update scripts to work with nerdfont, requiring trailing space, updated internet script to allow for WWAN

This commit is contained in:
2025-08-08 11:27:53 +02:00
parent a4a1f44e4e
commit 4779d4f566
4 changed files with 20 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
num=$(find ~/.local/share/mail/*/INBOX/new -type f | wc -l)
[ $num != 0 ] && printf "%s" "$num"
[ $num != 0 ] && printf " %s" "$num"
printf '\n'

View File

@@ -17,14 +17,23 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
# WWAN
if [ "$(cat /sys/class/net/ww*/operstate 2>/dev/null)" = 'up' ] ; then
wifiicon="$(awk '/^\s*w/ { print "" }' /proc/net/wireless)"
elif [ "$(cat /sys/class/net/ww*/operstate 2>/dev/null)" = 'down' ] ; then
[ "$(cat /sys/class/net/ww*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="" || wifiicon="❌"
fi
# Wifi
if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ] ; then
if [ "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" = 'up' ] ; then
wifiicon="$(awk '/^\s*w/ { print "" }' /proc/net/wireless)"
elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ] ; then
[ "$(cat /sys/class/net/w*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="" || wifiicon="❌"
elif [ "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" = 'down' ] ; then
[ "$(cat /sys/class/net/wl*/flags 2>/dev/null)" = '0x1003' ] && wifiicon="" || wifiicon="❌"
fi
# Ethernet
[ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && wifiicon=""
printf "%s%s%s\n" "$wifiicon"
printf "%s \n" "$wifiicon"

View File

@@ -1,6 +1,6 @@
#!/bin/sh
num="$(newsboat -x print-unread | cut -f1 -d ' ' )"
if ! pgrep newsboat > /dev/null ; then
[ "$num" -gt 0 ] 2>/dev/null && printf "%s" "$num"
[ "$num" -gt 0 ] 2>/dev/null && printf " %s" "$num"
printf '\n'
fi

View File

@@ -16,7 +16,7 @@ esac
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@)"
# If muted, print  and exit.
[ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit
[ "$vol" != "${vol%\[MUTED\]}" ] && echo  && exit
vol="${vol#Volume: }"
@@ -30,10 +30,10 @@ split() {
vol="$(printf "%.0f" "$(split "$vol" ".")")"
case 1 in
$((vol >= 70)) ) icon="" ;;
$((vol >= 30)) ) icon="" ;;
$((vol >= 1)) ) icon="" ;;
* ) echo  && exit ;;
$((vol >= 70)) ) icon=" " ;;
$((vol >= 30)) ) icon=" " ;;
$((vol >= 1)) ) icon=" " ;;
* ) echo  && exit ;;
esac
echo "$icon$vol%"