awesomewm/clients/titlebar.lua

73 lines
1.7 KiB
Lua
Raw Normal View History

2021-08-01 07:24:26 -07:00
-- Per-client titlebar setup
-- Required in rc.lua
local titlebar = {}
-- bar_buttons is a function. Whenever a title bar is created, its button binds
-- must be specific to the client it's attached to!
local bar_buttons = require("clients.binds.titlebar")
titlebar.add = function(client)
local bar = awful.titlebar(client, {
position = "left",
size = beautiful.dpi(25)
})
bar : setup {
-- Top segment
{
{
--awful.titlebar.widget.iconwidget(client),
awful.titlebar.widget.closebutton(client),
awful.titlebar.widget.minimizebutton(client),
awful.titlebar.widget.maximizedbutton(client),
spacing = beautiful.titlebar_spacing,
layout = wibox.layout.fixed.vertical
},
margins = beautiful.titlebar_margins,
widget = wibox.container.margin
},
-- Middle segment
{
--[[{} Title
align = "center",
widget = awful.titlebar.widget.titlewidget(client)
},]]
buttons = bar_buttons(client),
layout = wibox.layout.flex.vertical
},
-- Bottom segment
{
{
awful.titlebar.widget.floatingbutton(client),
awful.titlebar.widget.stickybutton(client),
awful.titlebar.widget.ontopbutton(client),
spacing = beautiful.titlebar_spacing,
layout = wibox.layout.fixed.vertical
},
margins = beautiful.titlebar_margins,
widget = wibox.container.margin
},
layout = wibox.layout.align.vertical
}
end
titlebar.update = function(client)
if (
(client.first_tag.layout == awful.layout.suit.floating or client.floating) and
--not (client.maximized) and
not (client.requests_no_titlebar)
) then
awful.titlebar.show(client, "left")
else
awful.titlebar.hide(client, "left")
end
end
return titlebar