22.04.2010 18:11

Awesome widget properties

Awesome progressbars The next stable release of the awesome window manager will introduce some new widget properties. When graphs and progress-bars were ported to Lua, in the 3.3 to 3.4 transition, some of the properties were lost. Most notably the progress-bar ticks, and the graphs ability to draw multiple values at once. Well, they are back, and will be included in awesome v3.4.5! To tell the truth they are not as nice as the old properties, because I tried to keep them as simple as possible (by design and implementation).

The progress-bar ticks introduce two new methods: "set_ticks_gap" and "set_ticks_size". Default gap size is 1, and tick size 4, in respect to the default progress-bar width of 100px. That's what the above picture shows, defaults. But if you use a lot of custom properties, and change the progress-bar size, it's up to you to pick the perfect gap and tick size for that progress-bar.

The graph stacking (also called multigraph by some) introduces these new methods: "set_stack" (false by default) and "set_stack_colors" (i.e. {"red", "white", "blue"}). The order of colors matters, because the "add_value" method now accepts an (optional) last argument, an index of a color from your stack color group. With these properties you can draw graphs similar to those found in Gnome, feed them multiple values and by specifying a color index they will all be drawn on the graph.

Remaining two are smaller properties, but could be as important as the others to some people. First of them found its way into awesome in the current 3.4.4 release. The progress-bar "max_value" property allows you to feed your progress-bars with any value without having to scale it to the 0-1 range. Graph widgets already supported this. The last property is the progress-bar "offset", which may not be included after all, but some future user might want it so I'll link to the mailing list patch. With offset the progress-bar will be drawn distanced from the border by as many pixels as the offset argument.


Written by anrxc | Permalink | Filed under desktop, code