I'm trying to load a
.png
to display a battery icon in conky. So far I've tried nesting the function call, using eval but I can't seem to find a solution.
Here is my non working conky.text:
conky.text = [[
${image ${lua battery_icon $battery_status $battery_icon}}
]]
Where my battery_icon
function looks like this:
function conky_battery_icon(battery_status, battery_percent)
if (battery_status == "charging")
then
icon = "charging-battery.png";
else
...
end
return("/path/to/icons/" .. icon);
end
I checked that the function works and I can get the correct path to the image by adding the following line to my conky.text
:
${lua battery_icon $battery_status $battery_percent}
How can I use the returned path of battery_icon
to load the file in conky's image
?
Related question: [Dynamic conky variable argument](https://unix.stackexchange.com/questions/193883/dynamic-conky-variable-argument/193906#193906)
Asked by phil
(113 rep)
Oct 1, 2019, 10:06 PM
Last activity: Mar 24, 2025, 09:54 AM
Last activity: Mar 24, 2025, 09:54 AM