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

30 lines
566 B
Text
Raw Permalink Normal View History

2022-07-04 21:36:33 +02:00
#!/bin/sh
2024-09-24 13:44:14 +02:00
. libsb
2024-09-23 14:47:30 +02:00
types=${SB_DISK_FS:-ext2,ext3,ext4,xfs,btrfs,vfat}
2023-11-21 14:34:46 +01:00
IFS='
'
first=true
2024-09-23 14:47:30 +02:00
for mnt in $(findmnt -Py -t "$types"); do
2024-09-24 13:44:14 +02:00
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
2023-11-21 14:34:46 +01:00
done