You are not logged in.
Hi everyone,
i tried to build a wifiwidget and i looks like this:
-- Wifi
netwidget = widget({ type = "textbox" })
vicious.register(netwidget, vicious.widgets.wifi, '${ssid}' , 3, "wlan0")
neticon = widget({ type = "imagebox" })
vicious.register(neticon, vicious.widgets.wifi,
function (widget, args)
if "${link}" > 40 then
neticons.image=image(beautiful.widget_wifi_hi)
elseif "${link}" > 20 and "${link}" <= 40 then
neticon.image=image(beautiful.widget_wifi_mid)
elseif "${link}" > 0 and "${link}" <= 20 then
neticon.image=image(beautiful.widget_wifi_low)
else
neticon.image=image(beautiful.widget_wifi_no)
end
end,
3, "wlan0")
But now i get an error message:
attempt to compare number with string
I'm not a lua programmer so this might be look ... crazy ..
Any help would be great. Thanks!
Offline
I don't know awesome.
But lua doesn't substitute variables in strings like shells do.
Try replacing all "${link}" with link.
And be sure that link is initialised.
vicious.register(neticon, vicious.widgets.wifi,
function (widget, args)
if link > 40 then
neticons.image=image(beautiful.widget_wifi_hi)
elseif link > 20 then
-- link <= 40 is always true here because of the else keyword
neticon.image=image(beautiful.widget_wifi_mid)
elseif link > 0 then
neticon.image=image(beautiful.widget_wifi_low)
else
neticon.image=image(beautiful.widget_wifi_no)
end
end,
3, "wlan0")Offline
I have searched the net for wifi widgets, and this is the only one i could get working halfway.
I do get the ssid for the textwidget, however its missing the wifiicon, as i dont know lua i assume a coding error.
But my custom rc.lua is loaded successfully and is working, well all but the wifi icon.
I have added "wifiicon," to the widgets list for the systray.
wifiwidget = widget({ type = "textbox" })
vicious.register(wifiwidget, vicious.widgets.wifi, '${ssid}' , 11, wifi)
wifiicon = widget({ type = "imagebox" })
vicious.register(wifiicon, vicious.widgets.wifi,
function (widget, args)
link = args['{link}']
-- wifiicon.visible = true -- didnt help
if link > 70 then
wifiicon.image=image(beautiful.widget_wifi_hi)
elseif link > 30 and link <= 70 then
wifiicon.image=image(beautiful.widget_wifi_mid)
elseif link > 0 and link <= 30 then
wifiicon.image=image(beautiful.widget_wifi_low)
else
wifiicon.image=image(beautiful.widget_wifi_no)
end
end,
3, wifi)Thank you for every input.
Regards
Simon
Offline