Add disk usage
This commit is contained in:
parent
51927219ef
commit
8eb17bf11d
2 changed files with 32 additions and 0 deletions
|
@ -48,6 +48,16 @@ interval=10
|
||||||
interval=10
|
interval=10
|
||||||
LABEL=<span foreground='#f59335'> </span>
|
LABEL=<span foreground='#f59335'> </span>
|
||||||
|
|
||||||
|
[free_disk_space]
|
||||||
|
interval=10
|
||||||
|
LABEL=<span foreground='#fec7cd'> </span>
|
||||||
|
DISK=/home/flyingscorpio
|
||||||
|
|
||||||
|
[free_disk_space]
|
||||||
|
interval=10
|
||||||
|
LABEL=<span foreground='#a1d569'> </span>
|
||||||
|
DISK=/run/media/flyingscorpio/Backup
|
||||||
|
|
||||||
[ccurrency]
|
[ccurrency]
|
||||||
LABEL=test
|
LABEL=test
|
||||||
command=scripts/ccurrency -f USD
|
command=scripts/ccurrency -f USD
|
||||||
|
|
22
dotfiles/i3/scripts/free_disk_space
Executable file
22
dotfiles/i3/scripts/free_disk_space
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
"""Simple script for i3blocks for disk free space.
|
||||||
|
|
||||||
|
Author: flyingscorpio
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def get_disk_free_space(disk: str) -> str:
|
||||||
|
"""Return available disk space in GiB."""
|
||||||
|
|
||||||
|
stat = os.statvfs(disk)
|
||||||
|
result = stat.f_bavail * stat.f_bsize / 1024 / 1024 / 1024
|
||||||
|
|
||||||
|
return "{0:0.1f}".format(result) + " GiB free"
|
||||||
|
|
||||||
|
|
||||||
|
OUTPUT = os.environ['LABEL'] + get_disk_free_space(os.environ["DISK"])
|
||||||
|
|
||||||
|
print(OUTPUT)
|
Loading…
Add table
Reference in a new issue