[modules/disk] Re-enable disk usage module
Add a module that shows the disk usage for various paths and opens nautilus on that path whenever it is clicked. see #23
This commit is contained in:
parent
771c597ce9
commit
12f5ce5977
3 changed files with 93 additions and 0 deletions
|
@ -18,6 +18,13 @@ def execute(cmd, wait=True):
|
|||
return out.decode("utf-8")
|
||||
return None
|
||||
|
||||
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)
|
||||
|
||||
def durationfmt(duration):
|
||||
minutes, seconds = divmod(duration, 60)
|
||||
hours, minutes = divmod(minutes, 60)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue