Compare commits
1 Commits
feat/disk-
...
feat/disk-
| Author | SHA1 | Date | |
|---|---|---|---|
| 44c9b11c9d |
@@ -77,6 +77,7 @@ exec-once = hypridle
|
|||||||
exec-once = hyprlock
|
exec-once = hyprlock
|
||||||
exec-once = /usr/bin/emacs --daemon
|
exec-once = /usr/bin/emacs --daemon
|
||||||
exec-once = dbus-update-activation-environment --systemd HYPRLAND_INSTANCE_SIGNATURE
|
exec-once = dbus-update-activation-environment --systemd HYPRLAND_INSTANCE_SIGNATURE
|
||||||
|
exec-once = $HOME/.config/waybar/scripts/disk-monitor.sh --daemon
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
### ENVIRONMENT VARIABLES ###
|
### ENVIRONMENT VARIABLES ###
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
"group/hardware",
|
"group/hardware",
|
||||||
"custom/disk-monitor",
|
|
||||||
"pulseaudio",
|
"pulseaudio",
|
||||||
"bluetooth",
|
"bluetooth",
|
||||||
"network",
|
"network",
|
||||||
|
|||||||
@@ -89,13 +89,6 @@
|
|||||||
"on-click": "kitty btop"
|
"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
|
||||||
"memory": {
|
"memory": {
|
||||||
"format": " {}% ",
|
"format": " {}% ",
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/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"
|
|
||||||
@@ -213,6 +213,28 @@ tooltip label {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* custom modules */
|
/* custom modules */
|
||||||
|
#custom-disk-monitor {
|
||||||
|
margin: 0px 0px 0px 5px;
|
||||||
|
padding: 1px 8px 0px 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: @text;
|
||||||
|
border-radius: 5px;
|
||||||
|
background-color: @set;
|
||||||
|
}
|
||||||
|
#custom-disk-monitor.warning {
|
||||||
|
background-color: #ff9a3c;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
#custom-disk-monitor.critical {
|
||||||
|
background-color: #dc2f2f;
|
||||||
|
color: #FFFFFF;
|
||||||
|
animation-name: blink;
|
||||||
|
animation-duration: 0.5s;
|
||||||
|
animation-timing-function: linear;
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
animation-direction: alternate;
|
||||||
|
}
|
||||||
|
|
||||||
#custom-exit {
|
#custom-exit {
|
||||||
margin: 0px 18px 0px 5px;
|
margin: 0px 18px 0px 5px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
|||||||
Reference in New Issue
Block a user