sb-disk: cleanup, use meters
This commit is contained in:
parent
61ac0b46fd
commit
4469bbc7fe
1 changed files with 19 additions and 4 deletions
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "colors"
|
. "colors"
|
||||||
|
|
||||||
|
types=${SB_DISK_FS:-ext2,ext3,ext4,xfs,btrfs,vfat}
|
||||||
|
|
||||||
IFS='
|
IFS='
|
||||||
'
|
'
|
||||||
|
|
||||||
types=${SB_DISK_FS:-ext2,ext3,ext4,xfs,btrfs,vfat}
|
|
||||||
first=true
|
first=true
|
||||||
|
|
||||||
for mnt in $(findmnt -Py -t "$types"); do
|
for mnt in $(findmnt -Py -t "$types"); do
|
||||||
eval "$mnt"
|
eval "$mnt"
|
||||||
case "$TARGET" in
|
case "$TARGET" in
|
||||||
|
@ -15,8 +16,22 @@ for mnt in $(findmnt -Py -t "$types"); do
|
||||||
/boot*) icon="" ;;
|
/boot*) icon="" ;;
|
||||||
*) icon="" ;;
|
*) icon="" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
$first || printf " "
|
$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
|
first=false
|
||||||
done
|
done
|
||||||
printf "\n"
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue