swaydots

my dotfiles
git clone https://git.awy.one/swaydots.git
Log | Files | Refs | README | LICENSE

sb-disk (586B)


      1 #!/bin/sh
      2 
      3 # Status bar module for disk space
      4 # $1 should be drive mountpoint, otherwise assumed /.
      5 
      6 location=${1:-/}
      7 
      8 [ -d "$location" ] || exit
      9 
     10 case $BLOCK_BUTTON in
     11   1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;;
     12   3) notify-send "💽 Disk module" "\- Shows used hard drive space.
     13 - Click to show all disk info." ;;
     14   8) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
     15 esac
     16 
     17 case "$location" in
     18   "/home"* ) icon="🏠" ;;
     19   "/mnt"* ) icon="💾" ;;
     20   *) icon="🖥";;
     21 esac
     22 
     23 printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')"