On 06.10.2011 23:50, Adrian C. wrote: > On Thu, 6 Oct 2011, Ignas Anikevicius wrote: > >> On 25/09/11 18:59, Adrian C. wrote: >>> Try like this: >>> fubar = awful.widget.progressbar() >>> fubar:set_height(25):set_width(25) >> >> I have tried that, but it does not give what I want. It is probably >> because I use git/master > > Yes it is. You are using development software that probably nobody but > Psychon knows how to use/draw with it.
Each widget in the Fancy And New Widget System (tm) has two methods. widget:draw(wibox, cr, width, height) draws the widget in the specified size with the given cr to the wibox. That part is easy. But how does the code now which size my widgets wants to be drawn at? That's what widget:fit(width, height) does. For example, the imagebox will apply its image's size ratio to that data. For the progressbar, that method just returns the width/height that you set. However, some layouts ignore the data from the fit() method return. In fact, only the align and fixed layout use :fit() (well, and technically margin and rotate do, too, but they don't really count). The flex layout will just give each widget and equally large chunk of space, ignoring fit() completely. At the same time, align and fixed only honor the in-direction component of fit()s return value and ignore the other. This is why setting a progressbar's height had no effect. I think this behavior is needed so that text is properly centered in the wibox. Else it might be a little too much to the top. :-/ For a fix, what comes to my mind is adding a new layout. Something like wibox.layout.force_size(widget, width, height) which makes fit() always return that size and which also tries to force draw() to that size. Hm... Uli -- - Buck, when, exactly, did you lose your mind? - Three months ago. I woke up one morning married to a pineapple. An ugly pineapple... But I loved her. -- To unsubscribe, send mail to [email protected].
