2020-02-08 23:43:37 +00:00
|
|
|
#!/bin/sh
|
2019-11-23 21:23:24 +00:00
|
|
|
|
|
|
|
# Status bar module for disk space
|
2020-04-01 00:29:34 +00:00
|
|
|
# $1 should be drive mountpoint, otherwise assumed /.
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2020-04-01 00:29:34 +00:00
|
|
|
location=${1:-/}
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2020-04-01 00:29:34 +00:00
|
|
|
[ -d "$location" ] || exit
|
2019-11-23 21:23:24 +00:00
|
|
|
|
|
|
|
case $BLOCK_BUTTON in
|
2020-04-01 00:29:34 +00:00
|
|
|
1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;;
|
|
|
|
3) notify-send "💽 Disk module" "\- Shows used hard drive space.
|
2019-11-23 21:23:24 +00:00
|
|
|
- Click to show all disk info." ;;
|
2020-05-07 21:31:42 +00:00
|
|
|
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
|
2019-11-23 21:23:24 +00:00
|
|
|
esac
|
|
|
|
|
2020-04-01 00:29:34 +00:00
|
|
|
case "$location" in
|
|
|
|
"/home"* ) icon="🏠" ;;
|
|
|
|
"/mnt"* ) icon="💾" ;;
|
2020-04-24 12:44:48 +00:00
|
|
|
*) icon="🖥";;
|
2020-04-01 00:29:34 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"
|