1
0
Fork 0
dotfiles/common/.local/libexec/statusbar/sb-disk

30 lines
566 B
Bash
Executable File

#!/bin/sh
. libsb
types=${SB_DISK_FS:-ext2,ext3,ext4,xfs,btrfs,vfat}
IFS='
'
first=true
for mnt in $(findmnt -Py -t "$types"); do
eval "$mnt"
case "$TARGET" in
/var/lib/docker) break ;;
/) icon="󰙅" ;;
/home) icon="󰋜" ;;
/boot*) icon="󰐥" ;;
*) icon="" ;;
esac
$first || printf " "
percent=$(df "$TARGET" | awk 'NR != 1 { gsub(/%/, "", $5); printf "%d", $5 }')
meter=$(meter_bar "$percent")
printf "%b <span %b %b>%b</span>" "${icon}" "$(echo "$meter" | cut -d: -f1)" "${bggray}" "$(echo "$meter" | cut -d: -f2)"
first=false
done