mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
Fixed zero swap and memory
This commit is contained in:
parent
5bcf76a136
commit
0d3aacdec7
@ -186,8 +186,11 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
def memText(self):
|
def memText(self):
|
||||||
"""function to set mem text"""
|
"""function to set mem text"""
|
||||||
full = self.mem_uf + self.mem_free
|
full = self.mem_uf + self.mem_free
|
||||||
|
try:
|
||||||
mem = 100 * self.mem_used / full
|
mem = 100 * self.mem_used / full
|
||||||
mem = "%5s" % (str(round(mem, 1)))
|
mem = "%5s" % (str(round(mem, 1)))
|
||||||
|
except:
|
||||||
|
mem = " N\\A"
|
||||||
if (self.memFormat.split('$mem')[0] != self.memFormat):
|
if (self.memFormat.split('$mem')[0] != self.memFormat):
|
||||||
line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1]
|
line = self.memFormat.split('$mem')[0] + mem + self.memFormat.split('$mem')[1]
|
||||||
else:
|
else:
|
||||||
@ -199,8 +202,11 @@ class pyTextWidget(plasmascript.Applet):
|
|||||||
def swapText(self):
|
def swapText(self):
|
||||||
"""function to set swap text"""
|
"""function to set swap text"""
|
||||||
full = self.swap_used + self.swap_free
|
full = self.swap_used + self.swap_free
|
||||||
|
try:
|
||||||
mem = 100 * self.swap_used / full
|
mem = 100 * self.swap_used / full
|
||||||
mem = "%5s" % (str(round(mem, 1)))
|
mem = "%5s" % (str(round(mem, 1)))
|
||||||
|
except:
|
||||||
|
mem = " N\\A"
|
||||||
if (self.swapFormat.split('$swap')[0] != self.swapFormat):
|
if (self.swapFormat.split('$swap')[0] != self.swapFormat):
|
||||||
line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1]
|
line = self.swapFormat.split('$swap')[0] + mem + self.swapFormat.split('$swap')[1]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user