[Feature Request] Add customgraph module
Hi, thank you for the awesome bar!
I was wondering, would it be possible to add a module creating a graph such as for example CPUGraph from QTile or Graph from eww. Ideally of course with being able to feed it custom data through continuous script similarly as custom module works.
I can now simulate it with the help of Sparks font, but it's a bit janky and it doesn't support all possible styling option.
I can help out a bit, however my C++ is very rusty so I wouldn't be the best help :)
Thank you!
that would be nice
Hello, I've started to experiment to add support for real graphs (for now line only), this is how the CPU usage looks like:
You can check the code at https://github.com/Gazer/Waybar/tree/feat/basic-cpu-graph
@Gazer That looks great! Would you be willing to create a PR for it?
And, more importantly, would @Alexays be interested in merging it?
@imiric the idea is to end with a PR, right now I´m exploring to add a custom-graph similar to the custom module so you can use an external script to draw a graph and I want to add two more types: gauge and bars. E.g. for temperature a gauge has more sense a disk usage with bars or something like that.
@Gazer I'm interested in your work, the new module and how to configure it.
@Gazer any progress on this?
I'm doing the final testing and polish but I may be able to do a PR to get feedback next week. I've working three graph types with native or custom modules.
This config:
"custom-graph/memory": {
"interval": 60,
"graph_type": "gauge",
"width": 52,
"exec": "/home/gazer/mem.sh",
"signal": 8,
"return-type": "json"
},
"custom-graph/disk": {
"interval": 2,
"graph_type": "bar",
"width": 10,
"exec": "/home/gazer/disk.sh",
"signal": 8,
"return-type": "json"
},
cpu_graph": {
"interval": 2,
"graph_type": "line",
"y_offset": 4,
"width": 50,
"on-click": "$TERMINAL -e btop"
},
creates
Missing things:
- man pages
- gauge and bar customization (right now the colors are hard-coded)
PR created, I've drop the idea of the rainbown colors since do not match the style. Instead played with the alpha to create a shades of the main color
@Gazer did the graph scale automatically,for example custom a network traffic line graph, when traffic change from 10k - 1M to 1M - 10M?
Hi , no, this initial version just allow you to render values from 0 to 100, so the scale change is not implemented. It should work mostly for any value that can be mapped to a percentage for now since that's what was available in the custom json format.
A native network module may do some work to support re-scaling by recalculating all the values in the vector but I did not take the time to try it since I focused on the disk, memory and cpu.
@Gazer graph should implement something to indicate different scale, line color changed or vertical marks or fill density, so script can pass more data to scale.
@vincentaxhe I agree, but since this is an initial implementation I rather prefer to keep it simple for now. I use this gist to monitor network with autocale and work decently:
"custom-graph/net-up": {
"exec": "$HOME/netp.sh up",
"width": 5,
"graph_type": "bar",
"return-type": "json"
},
"custom-graph/net-down": {
"exec": "$HOME/netp.sh down",
"width": 5,
"graph_type": "bar",
"return-type": "json"
}
and the style:
#custom-graph-net-up {
color: #fa7070;
}
#custom-graph-net-down {
color: #0080c0;
}