push all the updates
This commit is contained in:
16
.config/waybar/scripts/check-mount.sh
Executable file
16
.config/waybar/scripts/check-mount.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/bash
|
||||
# Usage: check-mount.sh <mountpoint> <label>
|
||||
# Outputs Waybar custom module JSON
|
||||
|
||||
MOUNT="$1"
|
||||
LABEL="$2"
|
||||
ICON_MOUNT=""
|
||||
ICON_DOWN=""
|
||||
|
||||
if mountpoint -q "$MOUNT"; then
|
||||
read -r used avail pcent <<< "$(df -h --output=used,avail,pcent "$MOUNT" | tail -1)"
|
||||
printf '{"text": "%s %s %s/%s (%s)", "tooltip": "%s mounted — used: %s, free: %s (%s)", "class": "mounted"}\n' \
|
||||
"$ICON_MOUNT" "$LABEL" "$used" "$avail" "$pcent" "$MOUNT" "$used" "$avail" "$pcent"
|
||||
else
|
||||
printf '{"text": "%s %s N/A", "tooltip": "%s is NOT mounted", "class": "unmounted"}\n' "$ICON_DOWN" "$LABEL" "$MOUNT"
|
||||
fi
|
||||
Reference in New Issue
Block a user