summaryrefslogtreecommitdiff
path: root/.config/waybar/modules/storagehome.sh
diff options
context:
space:
mode:
authorlxf <sng@luxagraf.net>2022-04-05 10:18:12 -0400
committerlxf <sng@luxagraf.net>2022-04-05 10:18:12 -0400
commit45c4fbcc06d5bfd452c2f054930cd7eeb374ff19 (patch)
tree4969657401e100a60bde941da70b8f1881f82c6d /.config/waybar/modules/storagehome.sh
parente2737d673880d1a4896490f784919bcf08b8af9d (diff)
wrapped up all the updates into one commit
Diffstat (limited to '.config/waybar/modules/storagehome.sh')
-rwxr-xr-x.config/waybar/modules/storagehome.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/.config/waybar/modules/storagehome.sh b/.config/waybar/modules/storagehome.sh
new file mode 100755
index 0000000..e59c051
--- /dev/null
+++ b/.config/waybar/modules/storagehome.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+mount="/home"
+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"\"}"
+}
+ '