sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit fdc2b45098c8443ad55fea32ef0003773e3358cd
parent 4d2702b97a0d4baf3b37129e61d72bd4999846f9
Author: Wojciech Gac <wgac@wp.pl>
Date:   Tue, 18 Jan 2011 16:16:57 +0100

Simplified the memory indicator by abstracting redundant function calls.
Diffstat:
Mwmii.suckless.org/code_snippets/python/memory_usage_indicator.md | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/wmii.suckless.org/code_snippets/python/memory_usage_indicator.md b/wmii.suckless.org/code_snippets/python/memory_usage_indicator.md @@ -16,11 +16,11 @@ you see fit. @defmonitor def fmem(self): inp = subprocess.Popen(['free'], shell = False, stdout = subprocess.PIPE) - out = inp.communicate() - ram = int(out[0].splitlines()[2].split()[2])/1024 - maxram = int(out[0].splitlines()[1].split()[1])/1024 - swap = int(out[0].splitlines()[3].split()[2])/1024 - maxswap = int(out[0].splitlines()[3].split()[1])/1024 + out = inp.communicate()[0].splitlines() + ram = int(out[2].split()[2])/1024 + maxram = int(out[1].split()[1])/1024 + swap = int(out[3].split()[2])/1024 + maxswap = int(out[3].split()[1])/1024 return wmii.cache['normcolors'], 'RAM: ' + str(ram) + '/' + str(maxram) +\ ' MB' + ' | SWAP: ' + str(swap) + '/' + str(maxswap) + ' MB'