Closed android-808 closed 11 years ago
I will try to add a condition that could display "no swap". But, since swap it's a must have with linux i will keep this in low priority.
Swap is not a must have if you have sufficient amount of RAM. Some people do without and only create a swap file when using suspend/hibernate.
Agree, maybe the word "best practical" would fit better in my quotes. But idt most of ppl wouldnt like to have suspend/hibernate or optimizing memory usage just to save a little of space in the hd.
Even if it still just displays 0%, N/A or something. Just needs to handle cases where swap is unavailable, which is currently causing the rest of it being displayed incorrectly.
A little bit of testing today. Conky returns "No Swap" if no swap is active. This is being parsed by conkySLS.lua using tonumber() which is causing the problem. It really wants a conditional assignment where referenced to check if it is returning a string or a number and act accordingly.
I found this, maybe it helps: http://www.troubleshooters.com/codecorn/lua/luavariables.htm#_Numbers
I was playing around with conditionals, which in Lua are a bit..weird:
var = condition and a or b
Couldn't get it to work though, may end up passing control to a function to get value. If you replace the tonumber() @ line 841 with tostring() it will print "No Swap %", but covers up the other values.
Fix ready to push, just need decent net connection from laptop.
If you have no swap space mounted/active on the system, conkySLS.lua fails with the following error:
Conky: llua_do_call: function conky_main execution failed: /usr/share/conkycolors/scripts/conkySLS.lua:841: attempt to concatenate a nil value
As soon as swapon /dev/sda1 or whatever is run, the error disappears and all is well. Also helpfully highlighted an error with my apparenty auto-generated fstab!