diff --git a/.local/libexec/statusbar/sb-memory b/.local/libexec/statusbar/sb-memory index b5cb3c78..fcc23165 100755 --- a/.local/libexec/statusbar/sb-memory +++ b/.local/libexec/statusbar/sb-memory @@ -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 "󰘚 %s" "${bggray}" "${color}" "$bar"