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 }},
|
}, 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.
|
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||||
-- { rule = { class = "Firefox" },
|
-- { rule = { class = "Firefox" },
|
||||||
-- properties = { screen = 1, tag = "2" } },
|
-- properties = { screen = 1, tag = "2" } },
|
||||||
|
@ -481,48 +486,48 @@ client.connect_signal("manage", function (c)
|
||||||
-- Prevent clients from being unreachable after screen count changes.
|
-- Prevent clients from being unreachable after screen count changes.
|
||||||
awful.placement.no_offscreen(c)
|
awful.placement.no_offscreen(c)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
local titlebars_enabled = true
|
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||||
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
|
client.connect_signal("request::titlebars", function(c)
|
||||||
-- buttons for the titlebar
|
-- buttons for the titlebar
|
||||||
local buttons = awful.util.table.join(
|
local buttons = awful.util.table.join(
|
||||||
awful.button({ }, 1, function()
|
awful.button({ }, 1, function()
|
||||||
client.focus = c
|
client.focus = c
|
||||||
c:raise()
|
c:raise()
|
||||||
awful.mouse.client.move(c)
|
awful.mouse.client.move(c)
|
||||||
end),
|
end),
|
||||||
awful.button({ }, 3, function()
|
awful.button({ }, 3, function()
|
||||||
client.focus = c
|
client.focus = c
|
||||||
c:raise()
|
c:raise()
|
||||||
awful.mouse.client.resize(c)
|
awful.mouse.client.resize(c)
|
||||||
end)
|
end)
|
||||||
)
|
)
|
||||||
|
|
||||||
awful.titlebar(c) : setup {
|
awful.titlebar(c) : setup {
|
||||||
{ -- Left
|
{ -- Left
|
||||||
awful.titlebar.widget.iconwidget(c),
|
awful.titlebar.widget.iconwidget(c),
|
||||||
buttons = buttons,
|
buttons = buttons,
|
||||||
layout = wibox.layout.fixed.horizontal
|
layout = wibox.layout.fixed.horizontal
|
||||||
|
},
|
||||||
|
{ -- Middle
|
||||||
|
{ -- Title
|
||||||
|
align = "center",
|
||||||
|
widget = awful.titlebar.widget.titlewidget(c)
|
||||||
},
|
},
|
||||||
{ -- Middle
|
buttons = buttons,
|
||||||
{ -- Title
|
layout = wibox.layout.flex.horizontal
|
||||||
align = "center",
|
},
|
||||||
widget = awful.titlebar.widget.titlewidget(c)
|
{ -- Right
|
||||||
},
|
awful.titlebar.widget.floatingbutton (c),
|
||||||
buttons = buttons,
|
awful.titlebar.widget.maximizedbutton(c),
|
||||||
layout = wibox.layout.flex.horizontal
|
awful.titlebar.widget.stickybutton (c),
|
||||||
},
|
awful.titlebar.widget.ontopbutton (c),
|
||||||
{ -- Right
|
awful.titlebar.widget.closebutton (c),
|
||||||
awful.titlebar.widget.floatingbutton (c),
|
layout = wibox.layout.fixed.horizontal()
|
||||||
awful.titlebar.widget.maximizedbutton(c),
|
},
|
||||||
awful.titlebar.widget.stickybutton (c),
|
layout = wibox.layout.align.horizontal
|
||||||
awful.titlebar.widget.ontopbutton (c),
|
}
|
||||||
awful.titlebar.widget.closebutton (c),
|
|
||||||
layout = wibox.layout.fixed.horizontal()
|
|
||||||
},
|
|
||||||
layout = wibox.layout.align.horizontal
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Enable sloppy focus
|
-- Enable sloppy focus
|
||||||
|
|
|
@ -1122,6 +1122,12 @@ capi.client.add_signal("property::floating")
|
||||||
|
|
||||||
capi.client.add_signal("property::dockable")
|
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).
|
--- The client marked signal (deprecated).
|
||||||
-- @signal .marked
|
-- @signal .marked
|
||||||
capi.client.add_signal("marked")
|
capi.client.add_signal("marked")
|
||||||
|
|
|
@ -361,6 +361,10 @@ end
|
||||||
-- @tab props Properties to apply.
|
-- @tab props Properties to apply.
|
||||||
-- @tab[opt] callbacks Callbacks to apply.
|
-- @tab[opt] callbacks Callbacks to apply.
|
||||||
function rules.execute(c, props, callbacks)
|
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
|
-- Before requesting a tag, make sure the screen is right
|
||||||
if props.screen then
|
if props.screen then
|
||||||
|
|
Loading…
Reference in New Issue