Keep it short.

This commit is contained in:
Bartek Stalewski 2022-04-14 10:33:51 +02:00
parent c5a5df67a0
commit 51233cea8d
4 changed files with 16 additions and 17 deletions

View file

@ -13,4 +13,4 @@ for i in $(cat ~/.local/share/passwords); do
[ $count -ne 0 ] && export unread=$((unread + count)) [ $count -ne 0 ] && export unread=$((unread + count))
fi fi
done done
[ "$unread" -eq 0 ] && printf "" || printf "^c#ffffff^^b#005577^\uf7aa new mail: ${unread}^d^" [ "$unread" -eq 0 ] && printf "" || printf "^c#ffffff^^b#005577^\uf7aa ${unread} new^d^"

View file

@ -1,9 +1,8 @@
#!/bin/bash #!/bin/bash
case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
down) printf "^c#ffffff^^b#770000^no wifi^d^" ;; down) printf " ^c#ffffff^^b#770000^ no wifi^d^" ;;
up) up)
[ -n "$(ip address show dev wlan0 | grep 'inet ')" ] \ [ -n "$(ip address show dev wlan0 | grep 'inet ')" ] \
&& printf "$(iw dev wlan0 info | grep 'ssid ' | cut -d' ' -f2-)" \ && printf "" || printf " ^c#ffffff^^b#770000^no ip^d^" ;;
|| printf "^c#ffffff^^b#770000^no ip^d^" ;;
esac esac

View file

@ -12,17 +12,17 @@ if [ "${1}" = "micmute" ]; then
esac esac
kill -46 $(pidof dwmblocks) kill -46 $(pidof dwmblocks)
else else
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%') mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
volmute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
micmute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') micmute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
if [ "$volmute" = yes ] && [ "$micmute" = yes ]; then volmute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}')
if [ "$micmute" = yes ] && [ "$volmute" = yes ]; then
printf "^c#ffffff^^b#770000^\uf131 mute | \ufa80 mute^d^" printf "^c#ffffff^^b#770000^\uf131 mute | \ufa80 mute^d^"
elif [ "$vol" -eq 0 ] && [ "$mic" -eq 0 ]; then elif [ "$mic" -eq 0 ] && [ "$vol" -eq 0 ]; then
printf "^c#ffffff^^b#770000^\uf131 mute | \ufa80 mute^d^" printf "^c#ffffff^^b#770000^\uf131 mute | \ufa80 mute^d^"
else else
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micinfo="^c#ffffff^^b#770000^\uf131 mute | ^d^" || micinfo=""
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && volinfo="^c#ffffff^^b#770000^\ufa80 mute^d^" || volinfo="\uf028 ${vol}%%" [ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && volinfo="^c#ffffff^^b#770000^\ufa80 mute^d^" || volinfo="\uf028 ${vol}%%"
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micinfo="^c#ffffff^^b#770000^\uf131 mute^d^" || micinfo="\uf130 ${mic}%%" printf "${micinfo}${volinfo}"
printf "${micinfo} | ${volinfo}"
fi fi
fi fi

View file

@ -1,12 +1,12 @@
//Modify this file to change what commands output to your statusbar, and recompile using the make command. //Modify this file to change what commands output to your statusbar, and recompile using the make command.
static const Block blocks[] = { static const Block blocks[] = {
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/ /*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
{"", "sb-emerge", 1, 0 }, {"", "sb-emerge", 1, 0 },
{"", "sb-mail", 60, 16 }, {"", "sb-mail", 60, 16 },
{"", "sb-volume", 0, 12 }, {"", "sb-volume", 0, 12 },
{"\uf1eb ", "sb-network", 1, 0 }, {"\uf1eb ", "sb-network", 1, 0 },
{"\uf241 ", "sb-battery", 3, 0 }, {"\uf241 ", "sb-battery", 3, 0 },
{"\uf073 ", "date '+%F %I:%M:%S %p |'", 1, 0 }, {"\uf073 ", "date '+[%e] %I:%M:%S %p |'", 1, 0 },
}; };
//sets delimeter between status commands. NULL character ('\0') means no delimeter. //sets delimeter between status commands. NULL character ('\0') means no delimeter.