Evening, On 10.01.2013 17:28, lukash wrote: > On Thu, 10 Jan 2013 16:59:16 +0100 Uli Schlachter <psyc...@znc.in> > wrote: [...] >> Another "ARGH": This breaks client moving via clicking on its titlebar. This >> is >> implemented via :buttons() on the client title widget. Of course, since this >> widget is smaller now, it doesn't receive the mouse click if you are >> clicking in >> the "empty" area. > > ARGH indeed. > >> >> The only idea that I have so far: Wrap the titlewidget in another align >> layout >> and set the buttons on this one. That way we get both working client moving >> and >> a centered client title. >> >> However, this smells a lot like an ugly, ugly hack. Meh. > > Welcome to layout nesting abuse, the way it was meant to be :) You can > also put a flex layout into align's middle widget (_the_ layout to use > if you want to stretch something to use all the space, if you have one > widget or more, imo) and put only the title in it. If you want it > centered, title:set_align("center") (or how does it go)?
Since this FS#1116 which is now the only blocker for 3.5.1, I decided to finally do something about this. The result is the attached patch. Besides implementing your idea, this also makes possible to drag the client via its icon. Just because I noticed this problem while testing this patch. Opinions? Any ideas on how this could be done in a saner way? Uli -- "Do you know that books smell like nutmeg or some spice from a foreign land?" -- Faber in Fahrenheit 451
diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 440bf76..7f87517 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -384,11 +384,26 @@ client.connect_signal("manage", function (c, startup) end end - local titlebars_enabled = false + local titlebars_enabled = true if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then + -- buttons for the titlebar + local buttons = awful.util.table.join( + awful.button({ }, 1, function() + client.focus = c + c:raise() + awful.mouse.client.move(c) + end), + awful.button({ }, 3, function() + client.focus = c + c:raise() + awful.mouse.client.resize(c) + end) + ) + -- Widgets that are aligned to the left local left_layout = wibox.layout.fixed.horizontal() left_layout:add(awful.titlebar.widget.iconwidget(c)) + left_layout:buttons(buttons) -- Widgets that are aligned to the right local right_layout = wibox.layout.fixed.horizontal() @@ -399,25 +414,17 @@ client.connect_signal("manage", function (c, startup) right_layout:add(awful.titlebar.widget.closebutton(c)) -- The title goes in the middle + local middle_layout = wibox.layout.flex.horizontal() local title = awful.titlebar.widget.titlewidget(c) - title:buttons(awful.util.table.join( - awful.button({ }, 1, function() - client.focus = c - c:raise() - awful.mouse.client.move(c) - end), - awful.button({ }, 3, function() - client.focus = c - c:raise() - awful.mouse.client.resize(c) - end) - )) + title:set_align("center") + middle_layout:add(title) + middle_layout:buttons(buttons) -- Now bring it all together local layout = wibox.layout.align.horizontal() layout:set_left(left_layout) layout:set_right(right_layout) - layout:set_middle(title) + layout:set_middle(middle_layout) awful.titlebar(c):set_widget(layout) end