suckless-utils/scripts/dwmblocks/sb-disk

17 lines
459 B
Plaintext
Raw Permalink Normal View History

#!/bin/sh
# Displays the disk usages of root and home partitions.
case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
. sb-theme
fetchDiskUsage() {
avail=$(df "$1" | awk 'NR==2 {printf "%2.1f", ($4 / 1024 / 1024)}')
percentUsed=$(df "$1" | awk -F'[^0-9]*' 'NR==2 {print $5}')
[ "$percentUsed" -le 10 ] && color=10
display "${avail}G" "$color"
}
echo "$(display 󰋊) $(fetchDiskUsage /)$(display "|")$(fetchDiskUsage /home)"