blob: a98a40c9fffbe77e0e51cc38a0af7b343b8a70b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/env python3
import os
ICON = "\U000f02ca" #
GB = 1073741824
def main():
statvfs = os.statvfs("/")
avail = bytes = statvfs.f_bavail * statvfs.f_frsize
for unit in ["B", "KB", "MB", "GB", "TB", "PB"]:
if avail < 1024.0 or unit == "PB":
break
avail /= 1024.0
print(f" {ICON} {round(avail)}{unit} \n")
if bytes < (20 * GB):
print(f"#{os.environ.get("BASE16_COLOR_00_HEX")}")
print(f"#{os.environ.get("BASE16_COLOR_08_HEX")}")
elif bytes < (10 * GB):
print(f"#{os.environ.get("BASE16_COLOR_00_HEX")}")
print(f"#{os.environ.get("BASE16_COLOR_0A_HEX")}")
if __name__ == "__main__":
main()
|