statusbar: padded percentages

master
tiyn 1 year ago
parent 256be15c0f
commit 0c6942bb7d

@ -1,7 +1,12 @@
#!/bin/sh #!/bin/sh
icon="^b#282828^^c#dfdfdf^  ^d^ "
if [ "$1" = "amd" ]; then if [ "$1" = "amd" ]; then
sensors | awk '/Tctl/ {print "^b#282828^^c#dfdfdf^  ^d^ " $2}' temp=$(sensors | awk '/Tctl/ {print $2}')
elif [ "$1" = "intel" ]; then elif [ "$1" = "intel" ]; then
sensors | awk '/Core 0/ {print "^b#282828^^c#dfdfdf^  ^d^ " $3}' temp=$(sensors | awk '/Tctl/ {print $3}')
fi fi
temp=$(printf %3s $(echo ${temp##*+} | sed "s/\..*//") | tr ' ' ' ')
echo "$icon$temp°C"

@ -1,8 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env sh
#
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="^c#ff0000^ ^d^ -%" wifipercent=" ___"
[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "^c#dfdfdf^ ^d^", int($3 * 100 / 70) "%" }') [ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="^c#ff0000^ ^d^"
printf "%s %s\n" "$(cat /sys/class/net/e*/operstate | sed "s/down/^b#282828^^c#ff0000^  /;s/up/^b#282828^^c#dfdfdf^ 󰈀 /")" "$wifiicon" [ ! -n "${wifiicon+var}" ] && wifiicon="^c#dfdfdf^ ^d^" && wifipercent=$(grep "^\s*w" /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
wifipercent=$(printf %3s $wifipercent | tr ' ' ' ')
echo "$(cat /sys/class/net/e*/operstate | sed "s/down/^b#282828^^c#ff0000^  /;s/up/^b#282828^^c#dfdfdf^ 󰈀 /")" "$wifiicon" "$wifipercent%"

@ -1,3 +1,5 @@
#!/bin/sh #!/bin/sh
free -h | awk '/^Mem:/ {print "^b#282828^^c#dfdfdf^  ^d^ " $3 "/" $2}' icon="^b#282828^^c#dfdfdf^  ^d^ "
total=$(free -h | awk '/^Mem:/ {print $3/$2}')
echo "$icon$(printf %3s $(echo ${total##*0.} | cut -c1-2) | tr ' ' ' ')%"

@ -3,14 +3,14 @@
vol="$(pulsemixer --get-volume | awk '{print $1}')" vol="$(pulsemixer --get-volume | awk '{print $1}')"
if [ "$vol" -eq "0" ]; then if [ "$vol" -eq "0" ]; then
vol_info="^c#ff0000^ ^d^ $vol%" vol_info="^d^ "
elif [ "$vol" -gt "70" ]; then elif [ "$vol" -gt "70" ]; then
vol_info="^c#dfdfdf^ ^d^ $vol%" vol_info="^c#dfdfdf^ ^d^"
else else
vol_info="^c#dfdfdf^ ^d^ $vol%" vol_info="^c#dfdfdf^ ^d^"
fi fi
[ "$(pulsemixer --get-mute)" = "1" ] && vol_info="^c#ff0000^ ^d^ -%" [ "$(pulsemixer --get-mute)" = "1" ] && vol_info="^c#ff0000^ ^d^"
if amixer get Capture | tail -2 | grep -q '\[on\]'; then if amixer get Capture | tail -2 | grep -q '\[on\]'; then
mic="^b#282828^^c#dfdfdf^  " mic="^b#282828^^c#dfdfdf^  "
@ -18,4 +18,5 @@ else
mic="^b#282828^^c#ff0000^  " mic="^b#282828^^c#ff0000^  "
fi fi
printf "%s %s %s\\n" "$mic" "$vol_info" vol=$(printf %3s $vol | tr ' ' ' ')
printf "%s %s %s %s\\n" "$mic" "$vol_info" "$vol%"

Loading…
Cancel
Save