diff options
author | clarkzjw <[email protected]> | 2022-11-17 10:56:25 -0800 |
---|---|---|
committer | clarkzjw <[email protected]> | 2022-11-17 10:56:25 -0800 |
commit | d2d735742ca61b211c9b48a2209d36395daebcf4 (patch) | |
tree | bda27729a1bbac3ab354a1f10d4885899cdbf967 /dot_config/i3/scripts/executable_disk | |
parent | a6d2e5e6fb9adc84c32e86630b4846b1765c7d77 (diff) | |
download | dotfiles-d2d735742ca61b211c9b48a2209d36395daebcf4.tar.gz |
+ add existing config
Diffstat (limited to 'dot_config/i3/scripts/executable_disk')
-rw-r--r-- | dot_config/i3/scripts/executable_disk | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dot_config/i3/scripts/executable_disk b/dot_config/i3/scripts/executable_disk new file mode 100644 index 0000000..e18c7aa --- /dev/null +++ b/dot_config/i3/scripts/executable_disk | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Copyright (C) 2014 Julien Bonjean <[email protected]> | ||
3 | |||
4 | # This program is free software: you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation, either version 3 of the License, or | ||
7 | # (at your option) any later version. | ||
8 | |||
9 | # This program is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | |||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | DIR="${DIR:-$BLOCK_INSTANCE}" | ||
18 | DIR="${DIR:-$HOME}" | ||
19 | ALERT_LOW="${ALERT_LOW:-$1}" | ||
20 | ALERT_LOW="${ALERT_LOW:-10}" # color will turn red under this value (default: 10%) | ||
21 | |||
22 | LOCAL_FLAG="-l" | ||
23 | if [ "$1" = "-n" ] || [ "$2" = "-n" ]; then | ||
24 | LOCAL_FLAG="" | ||
25 | fi | ||
26 | |||
27 | df -h -P $LOCAL_FLAG "$DIR" | awk -v label="$LABEL" -v alert_low=$ALERT_LOW ' | ||
28 | /\/.*/ { | ||
29 | # full text | ||
30 | print label $4 | ||
31 | |||
32 | # short text | ||
33 | print label $4 | ||
34 | |||
35 | use=$5 | ||
36 | |||
37 | # no need to continue parsing | ||
38 | exit 0 | ||
39 | } | ||
40 | |||
41 | END { | ||
42 | gsub(/%$/,"",use) | ||
43 | if (100 - use < alert_low) { | ||
44 | # color | ||
45 | print "#FF0000" | ||
46 | } | ||
47 | } | ||
48 | ' | ||