helmuthdu / conky_colors

CONKY-colors is an easier way to configure Conky
GNU General Public License v3.0
123 stars 39 forks source link

SLS Fails If No Swap Space Active #22

Closed android-808 closed 11 years ago

android-808 commented 12 years ago

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!

helmuthdu commented 12 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.

android-808 commented 12 years ago

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.

helmuthdu commented 12 years ago

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.

android-808 commented 12 years ago

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.

android-808 commented 12 years ago

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.

helmuthdu commented 12 years ago

I found this, maybe it helps: http://www.troubleshooters.com/codecorn/lua/luavariables.htm#_Numbers

android-808 commented 12 years ago

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.

android-808 commented 11 years ago

Fix ready to push, just need decent net connection from laptop.