brndnmtthws / conky

Light-weight system monitor for X, Wayland (sort of), and other things, too
https://conky.cc
GNU General Public License v3.0
7.17k stars 615 forks source link

Allow referencing/placing graphs from Lua #204

Closed eikenb closed 8 months ago

eikenb commented 8 years ago

I'd like to specify graphs (eg. cpugraph) from inside the lua script. Give it's location and options programmatically. The graphs are currently the only thing I still need to specify in the conky.text area, if they could be placed form lua I could have everything be drawn according to calculations based on a few parameters, which makes it much easier to play with layouts.

plikhari commented 8 years ago

conky objects have a lot of options - case in point cpugraph (cpuN) (height),(width) (gradient colour 1) (gradient colour 2) (scale) (-t) (-l) If I get what you are saying is - you want to show cpugraph conky object from within lua script.

Here is the issue - both have a different position co-ordinate system. cpugraph is placed inline like any text item and has no positional requirement. lua objects like image objects - need a position - x,y co-ordinate based on height and width of the conky window.

chepioq commented 8 years ago

For graph with lua, look here : http://u-scripts.blogspot.fr/2010/07/bargraph-widget.html and here : http://u-scripts.blogspot.fr/2010/10/graph-widget.html http://u-scripts.blogspot.fr/2010/02/bargraph-widget.html

eikenb commented 8 years ago

I understand that it might not fit, it was just an idea and I thought it might work out as conky seems to be moving more toward Lua as the config language as well as a way to script enhancements. Another option for this might be to set the conky.text value from within the lua, that way you could calculate the locations when the script is loaded and generate the text at that point. This isn't exactly what this issue requested, but it would allow for the same end to be reached. To have the entire conky display generated from the lua script.

plikhari commented 8 years ago

Yes I understand what you mean - but from what I can see in the source - lua is just used to read the config and nothing more. Perhaps the only basic change from 1.9 to 1.10. Rest of the lua is just integration as a scripting language - the core remains as is ( c or c++ ). conky.text value is obtainable using conky_parse(string) - but like @chepioq suggested and is widely used - use lua to generate a graph (using cairo) - the speed is just fantastic - lua is really good for small scripts. Lua really extends conky - one can write every conky function in lua - and the way things are - some may even perform better than built in ones - from my experience.

lasers commented 6 years ago

2 years 7 months 15 days passed. What should we do with this issue today? Thanks.

plikhari commented 6 years ago

I shall have a look at it again - am responding to #652

plikhari commented 6 years ago

I have tried wrapping cpubar with LUA and passing ${voffset 100}${offset 15}${cpubar cpu2 5,70} to conky_parse - it does not work (offsets are ignored) - though if used as is in conky text section the desired pixel positioning is achieved - but you will need to do back flips to keep the rest of the conky window in a grip :-)

All bar, gauge, graph etc variables do not have a positioning x,y thing - only the image variable has positional markers.

it would benefit to add this.

We also have the LUA solutions as mentioned above.

piotao commented 4 years ago

Actually writing graphs in lua for me personally seems to be way simpler, using some cairo-related functions, and having them wrapped to my own lua functions for simplicity. So far I achieved something like this (unfinished yet) system which I run on a separate monitor: https://imgur.com/a/svPH6So

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 30 days with no activity.