diff options
author | Ryan Schanzenbacher <ryan@rschanz.org> | 2023-05-17 00:21:45 -0400 |
---|---|---|
committer | Ryan Schanzenbacher <ryan@rschanz.org> | 2023-05-17 00:21:45 -0400 |
commit | bf6a91943d2c5852025ed1d1aadb30d83edf0354 (patch) | |
tree | a7c4efde6a1e2d18919016e9dff81aee8db8f0fe /home-config/waybar/modules/storage.sh | |
parent | 4fe3a734d104fa1836255b18f8d8bcf4aeaa407f (diff) |
Added personal channel, starting to add more dotfiles
Diffstat (limited to 'home-config/waybar/modules/storage.sh')
-rwxr-xr-x | home-config/waybar/modules/storage.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/home-config/waybar/modules/storage.sh b/home-config/waybar/modules/storage.sh new file mode 100755 index 0000000..90cc3dc --- /dev/null +++ b/home-config/waybar/modules/storage.sh | |||
@@ -0,0 +1,25 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | mount="/" | ||
4 | warning=20 | ||
5 | critical=10 | ||
6 | |||
7 | df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' | ||
8 | /\/.*/ { | ||
9 | text=$4 | ||
10 | tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 | ||
11 | use=$5 | ||
12 | exit 0 | ||
13 | } | ||
14 | END { | ||
15 | class="" | ||
16 | gsub(/%$/,"",use) | ||
17 | if ((100 - use) < critical) { | ||
18 | class="critical" | ||
19 | } else if ((100 - use) < warning) { | ||
20 | class="warning" | ||
21 | } | ||
22 | print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" | ||
23 | } | ||
24 | ' | ||
25 | |||