diff options
| author | JackJ30 <jackqjamison@proton.me> | 2024-09-07 14:02:06 -0400 |
|---|---|---|
| committer | JackJ30 <jackqjamison@proton.me> | 2024-09-07 14:02:06 -0400 |
| commit | ee71cba8d51ea5635ebda2ba0c776e8378706c6d (patch) | |
| tree | eff818f88b2702724eea111eca4a55512543e971 /.config/waybar/modules/storage.sh | |
| parent | e70986a9c299f004aa290bde0ec430ca864f7e74 (diff) | |
better stow
Diffstat (limited to '.config/waybar/modules/storage.sh')
| -rwxr-xr-x | .config/waybar/modules/storage.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/.config/waybar/modules/storage.sh b/.config/waybar/modules/storage.sh new file mode 100755 index 0000000..90cc3dc --- /dev/null +++ b/.config/waybar/modules/storage.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +mount="/" +warning=20 +critical=10 + +df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' +/\/.*/ { + text=$4 + tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 + use=$5 + exit 0 +} +END { + class="" + gsub(/%$/,"",use) + if ((100 - use) < critical) { + class="critical" + } else if ((100 - use) < warning) { + class="warning" + } + print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" +} +' + |
