27 lines
607 B
Bash
Executable File
27 lines
607 B
Bash
Executable File
#/bin/sh
|
|
|
|
source $(dirname $0)/../.env
|
|
source $(dirname $0)/filesystem.data
|
|
|
|
output=""
|
|
for i in "${!parts[@]}"; do
|
|
avail=$(df -h ${parts[$i]} | tail -1 | tr -s ' ' | cut -d' ' -f4)
|
|
used=$(df -h ${parts[$i]} | tail -1 | tr -s ' ' | cut -d' ' -f5)
|
|
num=$(echo ${used} | cut -d'%' -f1)
|
|
|
|
if [ "$num" -gt 80 ] ; then
|
|
color="$MOCHA_RED"
|
|
elif [ "$num" -gt 50 ] ; then
|
|
color="$MOCHA_PEACH"
|
|
else
|
|
color="$MOCHA_MAUVE"
|
|
fi
|
|
output=$output"%{F${color}}${icons[$i]} $used%{F$MOCHA_TEXT} · $avail"
|
|
if [ $(($i + 1)) -ne "${#parts[@]}" ] ; then
|
|
output=$output" "
|
|
fi
|
|
|
|
done
|
|
|
|
echo "$output"
|