bumblebee-status/bumblebee/util.py
Tobias Witek bb6ca556c7 [modules] Add support for disk utilization
Add a new module "disk" that takes an optional parameter (the path) and
displays free & total disk space, along with the usage percentage.

Also, added Tunnel/VPN support to the themeing of the "net" module.
2016-10-31 13:34:48 +01:00

8 lines
198 B
Python

def bytefmt(num):
for unit in [ "", "Ki", "Mi", "Gi" ]:
if num < 1024.0:
return "{:.2f}{}B".format(num, unit)
num /= 1024.0
return "{:05.2f%}{}GiB".format(num)