1
0
Fork 0

sb-memory: replace output with bars

This commit is contained in:
Luca Bilke 2024-09-23 14:58:35 +02:00
parent 04d95a9908
commit f5a9256e32
1 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,14 @@
#!/bin/sh
. "colors"
printf "%b" "󰘚 "
free -m | awk 'NR==2 { printf ("%2.2fG/%2.2fG\n", ($3 / 1024), ($2 / 1024)) }'
case "$(free -m | awk 'NR==2 { printf "%d", ($3 / $2) * 10 }')" in
0 | 1) color="$fggreen" bar="▁" ;;
2) color="$fggreen" bar="▂" ;;
3 | 4) color="$fggreen" bar="▃" ;;
5) color="$fgorange" bar="▄" ;;
6 | 7) color="$fgorange" bar="▅" ;;
8) color="$fgred" bar="▆" ;;
*) color="$fgred" bar="▇" ;;
esac
printf "󰘚 <span %s %s>%s</span>" "${bggray}" "${color}" "$bar"