Without using Conky, I'm going to make an answer based on some assumptions I've made after reading the various configuration sections found on the wiki.
It appears to me that the 'variables' one uses in the conky.text
field, and other template fields, are not part of the Lua environment. That is to say, that the $
and ${}
syntax probably does not perform environment lookups to interpolate values. This might also mean that the nodename
variable you're comparing with is actually nil
.
In any event, if your lan
variable is not being interpolated, the quick fix is to simply concatenate your strings:
conky.text = [[${color yellow}]] .. lan.. [[ ${alignr}${addr wlp9s0}]]
Or consider writing your own string iterpolation function, if you want a cleaner looking string:
local function interp (s, t)
return s:gsub('(#%b{})', function (w)
return t[w:sub(3, -2)] or w
end)
end
conky.text = interp([[${color yellow}#{lan} ${alignr}${addr wlp9s0}]], {
lan = lan
})
Note, in the event that nodename
is not part of the Lua environment, you can try using io.popen
to run hostname
manually, and then read from the file handle it returns.