1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 <krigstask> How do I set textbox's border_width in 3.5?
 <psychon> krigstask: 3.4's textbox really has a border? why?!?
 <krigstask> Er... Well, yes, it still has
 <krigstask> textbox.border_width = 1
 <psychon> wow, weird stuff
 <psychon> if you are too lazy to write a "border layout widget" for yourself, you should be able to fake it via two background color layouts and some padding
 <krigstask> Pity, I'm sure lots of people miss it
 <krigstask> Maybe I'll manage to cook up some generic widget borderizer
 <psychon> ok, so let's go down that route (your job will then be to turn that into a generic "widget thingie" and send a patch)
 <krigstask> I'll do my best :)
 <psychon> local foo = wibox.widget.base.make_widget()
 <psychon> function foo:fit(width, height) local res = other:fit(width, height) ; return { width = res.width + 2*1, height = res.height + 2*1 } end
 <psychon> function foo:draw(wibox, cr, width, height) cr:save() cr:rectangle(1/2, 1/2, width - 1, height - 1) cr:set_source(gears.color("#000000")) cr:stroke() cr:restore() wibox.layout.base.draw_widget(wibox, cr, widhet, 1, 1, width - 2*1, height - 2*1) end
 <krigstask> What's `other` in fit()?
 <psychon> other:connect_signal("widget::updated", function() foo:emit_signal("widget::updated") end)
 <psychon> done
 <psychon> "other" is the widget that you want inside of the border, 1 is the border width, "2" is a constant which should stay "2", "#000000" is the border color
 <krigstask> So foo is just wrapper, and "2" seems to be a number of vertical/horizontal borders
 <psychon> if this should be turned into something "proper", I guess copying wibox.layout.margin and calling it wibox.layout.border would be a good start
 <psychon> I guess we could even make "margin" and "border" be the same widget because "margin" is just a border with the background color (more or less)
 <psychon> yeah, in one place "2" is "there are two lines", in another place (1/2) it means "half the line width is the center of the line"

This paste never expires. View raw. Pasted through import.