titlebars: Use the request system rather than 'manage'.
As awesomerc.lua "manage" section is executed after the rules, using a 'geometry' or 'placement' property in the rules was broken.
This commit is contained in:
parent
299e155acc
commit
f72dcce4bd
|
@ -458,6 +458,11 @@ awful.rules.rules = {
|
|||
}
|
||||
}, properties = { floating = true }},
|
||||
|
||||
-- Add titlebars to normal clients and dialogs
|
||||
{ rule_any = {type = { "normal", "dialog" }
|
||||
}, properties = { titlebars_enabled = true }
|
||||
},
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { screen = 1, tag = "2" } },
|
||||
|
@ -481,48 +486,48 @@ client.connect_signal("manage", function (c)
|
|||
-- Prevent clients from being unreachable after screen count changes.
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
end)
|
||||
|
||||
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)
|
||||
)
|
||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||
client.connect_signal("request::titlebars", function(c)
|
||||
-- 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)
|
||||
)
|
||||
|
||||
awful.titlebar(c) : setup {
|
||||
{ -- Left
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
awful.titlebar(c) : setup {
|
||||
{ -- Left
|
||||
awful.titlebar.widget.iconwidget(c),
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
{ -- Middle
|
||||
{ -- Title
|
||||
align = "center",
|
||||
widget = awful.titlebar.widget.titlewidget(c)
|
||||
},
|
||||
{ -- Middle
|
||||
{ -- Title
|
||||
align = "center",
|
||||
widget = awful.titlebar.widget.titlewidget(c)
|
||||
},
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.flex.horizontal
|
||||
},
|
||||
{ -- Right
|
||||
awful.titlebar.widget.floatingbutton (c),
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
awful.titlebar.widget.stickybutton (c),
|
||||
awful.titlebar.widget.ontopbutton (c),
|
||||
awful.titlebar.widget.closebutton (c),
|
||||
layout = wibox.layout.fixed.horizontal()
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
end
|
||||
buttons = buttons,
|
||||
layout = wibox.layout.flex.horizontal
|
||||
},
|
||||
{ -- Right
|
||||
awful.titlebar.widget.floatingbutton (c),
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
awful.titlebar.widget.stickybutton (c),
|
||||
awful.titlebar.widget.ontopbutton (c),
|
||||
awful.titlebar.widget.closebutton (c),
|
||||
layout = wibox.layout.fixed.horizontal()
|
||||
},
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
end)
|
||||
|
||||
-- Enable sloppy focus
|
||||
|
|
|
@ -1122,6 +1122,12 @@ capi.client.add_signal("property::floating")
|
|||
|
||||
capi.client.add_signal("property::dockable")
|
||||
|
||||
--- Emited when a client need to get a titlebar.
|
||||
-- @signal request::titlebars
|
||||
-- @tparam[opt=nil] string content The context (like "rules")
|
||||
-- @tparam[opt=nil] table hints Some hints.
|
||||
capi.client.add_signal("request::titlebars")
|
||||
|
||||
--- The client marked signal (deprecated).
|
||||
-- @signal .marked
|
||||
capi.client.add_signal("marked")
|
||||
|
|
|
@ -361,6 +361,10 @@ end
|
|||
-- @tab props Properties to apply.
|
||||
-- @tab[opt] callbacks Callbacks to apply.
|
||||
function rules.execute(c, props, callbacks)
|
||||
-- This has to be done first, as it will impact geometry related props.
|
||||
if props.titlebars_enabled then
|
||||
c:emit_signal("request::titlebars", "rules", {properties=props})
|
||||
end
|
||||
|
||||
-- Before requesting a tag, make sure the screen is right
|
||||
if props.screen then
|
||||
|
|
Loading…
Reference in New Issue