From 324495e7a304d69295360ebc32afacab84d8684d Mon Sep 17 00:00:00 2001 From: axtloss Date: Thu, 21 Jul 2022 23:13:00 +0200 Subject: [PATCH] change disk storage display --- src/scripts/getDiskSize.sh | 2 +- src/utils/disks.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/scripts/getDiskSize.sh b/src/scripts/getDiskSize.sh index 074372b..826fc40 100644 --- a/src/scripts/getDiskSize.sh +++ b/src/scripts/getDiskSize.sh @@ -1,2 +1,2 @@ #!/usr/bin/bash -flatpak-spawn --host lsblk -pdo SIZE $1 | grep -v SIZE \ No newline at end of file +flatpak-spawn --host lsblk -pdbo SIZE $1 | grep -v SIZE \ No newline at end of file diff --git a/src/utils/disks.py b/src/utils/disks.py index 1025ba1..861a2c7 100644 --- a/src/utils/disks.py +++ b/src/utils/disks.py @@ -17,7 +17,7 @@ # # SPDX-License-Identifier: GPL-3.0-only -import subprocess +import subprocess, math def get_disks(): command=subprocess.run(["bash", "-c", "bash -- /app/share/jade_gui/jade_gui/scripts/getDisks.sh"], capture_output=True) disks=command.stdout.decode('utf-8')[:-1].split('\n') @@ -27,4 +27,4 @@ def get_disk_size(disk: str): command=subprocess.run(["bash", "-c", "bash -- /app/share/jade_gui/jade_gui/scripts/getDiskSize.sh "+disk], capture_output=True) size=command.stdout.decode('utf-8').strip('\n') print(disk+":"+size) - return size+"iB" + return str(math.floor(int(size)/1000**3))+" GB"