diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2015-04-06 22:55:15 +0200 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2015-04-06 22:55:15 +0200 |
| commit | 75aca76aaf7412ef0d4abdddd3fbc5b2a541cfa1 (patch) | |
| tree | 92d8931927accb0072dcb1818f456d004107c085 | |
| parent | 0f0140f019a7a68679a6524c2af7614c571cdcfb (diff) | |
fix sysdata used RAM detection wrt issue #94 reported by @habash1986
| -rw-r--r-- | py3status/modules/sysdata.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/py3status/modules/sysdata.py b/py3status/modules/sysdata.py index f836bc1..9343722 100644 --- a/py3status/modules/sysdata.py +++ b/py3status/modules/sysdata.py @@ -24,6 +24,7 @@ class GetData: - `arg`: argument. """ result = subprocess.check_output([cmd, arg]) + result = result.decode('utf-8') return result def cpu(self): @@ -60,8 +61,9 @@ class GetData: """ # Run 'free -m' command and make a list from output. mem_data = self.execCMD('free', '-m').split() - total_mem = int(mem_data[7]) / 1024. - used_mem = int(mem_data[15]) / 1024. + mem_index = mem_data.index('Mem:') + total_mem = int(mem_data[mem_index + 1]) / 1024. + used_mem = int(mem_data[mem_index + 2]) / 1024. # Caculate percentage used_mem_percent = int(used_mem / (total_mem / 100)) |
