Re-write disk free blocks

This commit is contained in:
Jonathan Hodgson 2018-05-10 16:06:20 +01:00
parent efeebe39f0
commit 29ddb35978
2 changed files with 31 additions and 6 deletions

25
i3/blocks/freeSpace Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/sh
partition=$1
if [ ! -n "$partition" ]; then
partition="/"
fi
line=$(/usr/bin/df -h $partition | sed -n 2p)
used=$(echo $line | awk -F ' ' '{print $3}')
total=$(echo $line | awk -F ' ' '{print $2}')
percent=$(echo $line | awk -F ' ' '{print $5}' | sed 's/[^0-9]//')
echo "$used/$total $percent%"
echo "$used/$total"
if [ "$percent" -gt 80 ]; then
echo "#FF8000"
elif [ "$percent" -gt 90 ]; then
echo "#FF0000"
fi