sb-disk: cleanup, use meters
This commit is contained in:
parent
61ac0b46fd
commit
4469bbc7fe
|
@ -1,11 +1,12 @@
|
|||
#!/bin/sh
|
||||
. "colors"
|
||||
|
||||
types=${SB_DISK_FS:-ext2,ext3,ext4,xfs,btrfs,vfat}
|
||||
|
||||
IFS='
|
||||
'
|
||||
|
||||
types=${SB_DISK_FS:-ext2,ext3,ext4,xfs,btrfs,vfat}
|
||||
first=true
|
||||
|
||||
for mnt in $(findmnt -Py -t "$types"); do
|
||||
eval "$mnt"
|
||||
case "$TARGET" in
|
||||
|
@ -15,8 +16,22 @@ for mnt in $(findmnt -Py -t "$types"); do
|
|||
/boot*) icon="" ;;
|
||||
*) icon="" ;;
|
||||
esac
|
||||
|
||||
$first || printf " "
|
||||
printf "%b" "${icon} $(df -h "$TARGET" | awk ' /[0-9]/ {print $3 "/" $2}')"
|
||||
|
||||
percent=$(df "$TARGET" | awk 'NR != 1 { gsub(/%/, "", $5); print $5 }')
|
||||
case "$(printf %d $((percent / 10)))" in
|
||||
0 | 1) color=$fgwhite bar=▁ ;;
|
||||
2) color=$fgwhite bar=▂ ;;
|
||||
3 | 4) color=$fgwhite bar=▃ ;;
|
||||
5) color=$fgwhite bar=▄ ;;
|
||||
6 | 7) color=$fgwhite bar=▅ ;;
|
||||
8) color=$fgorange bar=▆ ;;
|
||||
9 | 10) color=$fgred bar=▇ ;;
|
||||
*) color=$fgblack bar= ;;
|
||||
esac
|
||||
|
||||
printf "%b <span %b %b>%b</span>" "${icon}" "${color}" "${bggray}" "${bar}"
|
||||
|
||||
first=false
|
||||
done
|
||||
printf "\n"
|
||||
|
|
Loading…
Reference in New Issue