Hi,

On 23.04.2012 11:25, Sławomir Kowalewski wrote:
> I have problem with network widget. When some transfer has place
> widget change it's value and move all widgets that are place before
> it.

It moves the widgets *before* it?
Shouldn't it move the widgets that come after it?

> Is there any why to set it's width to some fix value so it have
> some margin for changes?
> To create widget I use vicious.
> 
> I create netwidget like:
> 
> netupwidget = wibox.widget.textbox()
> vicious.register(netupwidget, vicious.widgets.net, '<span><b>${eth0
> up_kb}</b></span>', 3)

Here comes the magic:

netupwidget_box = wibox.widget.textbox()
vicious.register(netupwidget_box, vicious.widgets.net, '<span><b>${eth0
up_kb}</b></span>', 3)

netupwidget = wibox.widget.base.make_widget(netupwidget_box)
netupwidget.fit = function(_, w, h)
  return 100, h
end

Your netupwidget gets renamed to netupwidget_box (I'm bad at coming up with
names). netupwiget becomes a new widget. This widget always changes (=needs a
redraw) when netupwidget_box changes. When drawn, this widget just draws
netupwidget_box. (This magic is done in make_widget())

When asked for its size, it always says "my width is 100 pixel and my height is
whatever you have available".

The net result of this should be that you get a netupwidget which is always
100px wide.

Hope this helps.

Uli

P.S.:
I wonder if something like this should be added to awesome as a layout...

P.P.S.:
With the "old" widget layout code, I have no clue how something like this could
be done.

-- 
'dubito ergo sum'
-- Elke's whiteboard

-- 
To unsubscribe, send mail to [email protected].

Reply via email to