#!/bin/sh # Status bar module for disk space # Automatically detects /home if separate partition, otherwise uses / # Can override with $1 argument # Smart default: use /home if it's a separate partition, else / if [ -n "$1" ]; then location="$1" elif df /home 2>/dev/null | grep -q "^/dev" && [ "$(df / --output=source | tail -1)" != "$(df /home --output=source | tail -1)" ]; then location="/home" else location="/" fi [ -d "$location" ] || exit case $BLOCK_BUTTON in 1) notify-send "󰋊 Disk space" "$(df -h --output=target,used,size,avail,pcent /home / 2>/dev/null | head -5)" ;; 3) notify-send "󰋊 Disk module" "Shows disk space for $location - Left click for full disk info - Currently monitoring: $location" ;; 6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;; esac printf "󰋊 %s\n" "$(df -h "$location" | awk '/[0-9]/ {print $3 "/" $2}')"