1 Commits

4 changed files with 37 additions and 5 deletions

View File

@@ -25,6 +25,7 @@
"modules-right": [
"group/hardware",
"custom/disk-monitor",
"pulseaudio",
"bluetooth",
"network",

View File

@@ -88,6 +88,13 @@
"path": "/",
"on-click": "kitty btop"
},
// disk monitor (standalone, color-coded)
"custom/disk-monitor": {
"exec": "$HOME/.config/waybar/scripts/disk-monitor.sh --waybar",
"return-type": "json",
"interval": 60
},
// memory
"memory": {

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# disk-monitor.sh -- Waybar disk usage monitor
# Outputs JSON for custom/disk-monitor module
# Class: "good" (<80%), "warning" (80-90%), "critical" (>90%)
set -euo pipefail
# Target partition (default: root)
TARGET="${1:-/}"
# Get disk usage percentage (strip % sign)
USAGE=$(df --output=pcent "$TARGET" | tail -1 | tr -d '% ')
# Determine icon and CSS class based on usage thresholds
if [ "$USAGE" -ge 90 ]; then
CLASS="critical"
TOOLTIP="Disk $TARGET at ${USAGE}% - CRITICAL"
elif [ "$USAGE" -ge 80 ]; then
CLASS="warning"
TOOLTIP="Disk $TARGET at ${USAGE}% - Warning"
else
CLASS="good"
TOOLTIP="Disk $TARGET at ${USAGE}%"
fi
# Output JSON for waybar
printf '{"text": " \uf4be %s%% ", "class": "%s", "alt": "%s", "tooltip": "%s"}\n' \
"$USAGE" "$CLASS" "disk-$CLASS" "$TOOLTIP"

View File

@@ -89,11 +89,6 @@ alias dpa="docker ps -a"
alias dl="docker ps -l -q"
alias dx="docker exec -it"
# WireGuard
alias wg-up="sudo wg-quick up work-laptop"
alias wg-down="sudo wg-quick down work-laptop"
alias wg-status="sudo wg show"
# Cd
alias ..="cd .."
alias ...="cd ../.."