add(CLIENT_TITLEBAR) slot and ui component
This commit is contained in:
parent
fc3928923d
commit
a74a0ec702
17
init.lua
17
init.lua
|
@ -117,7 +117,22 @@ local ruled_client = slot {
|
|||
},
|
||||
}
|
||||
|
||||
require("awesome-wm-nice").initialize()
|
||||
-- luacheck: ignore unused variable client_titlebar
|
||||
local client_titlebar = slot {
|
||||
id = "CLIENT_TITLEBAR",
|
||||
connect = true,
|
||||
target = capi.client,
|
||||
signal = "request::titlebars",
|
||||
slot = my_slots.build_titlebars,
|
||||
}
|
||||
|
||||
gtimer.delayed_call(function()
|
||||
local nice_config = require "awesome-wm-nice.config"
|
||||
local nice_utils = require "awesome-wm-nice.utils"
|
||||
|
||||
nice_config.init()
|
||||
nice_utils.validate_mb_bindings(nice_config)
|
||||
end)
|
||||
|
||||
-- luacheck: ignore unused variable ruled_notification
|
||||
local ruled_notification = slot {
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
local abutton = require "awful.button"
|
||||
local atitlebar = require "awful.titlebar"
|
||||
local beautiful = require "beautiful"
|
||||
local lalign = require "wibox.layout.align"
|
||||
local lfixed = require "wibox.layout.fixed"
|
||||
local lflex = require "wibox.layout.flex"
|
||||
local naughty = require "naughty"
|
||||
|
||||
local slots = {}
|
||||
|
@ -78,42 +73,10 @@ function slots.build_desktop_decoration(screen)
|
|||
desktop_bar(screen)
|
||||
end
|
||||
|
||||
function slots.build_client_titlebars(client)
|
||||
-- Mouse buttons bindings for the titlebar
|
||||
local buttons = {
|
||||
abutton({}, 1, function()
|
||||
client:activate { context = "titlebar", action = "mouse_move" }
|
||||
end),
|
||||
abutton({}, 3, function()
|
||||
client:activate { context = "titlebar", action = "mouse_resize" }
|
||||
end),
|
||||
}
|
||||
function slots.build_titlebars(client)
|
||||
local titlebar = require "rc.ui.titlebar"
|
||||
|
||||
-- Titlebar UI
|
||||
atitlebar(client).widget = {
|
||||
{ -- Left
|
||||
atitlebar.widget.iconwidget(client),
|
||||
buttons = buttons,
|
||||
layout = lfixed.horizontal,
|
||||
},
|
||||
{ -- Middle
|
||||
{ -- Title
|
||||
align = "center",
|
||||
widget = atitlebar.widget.titlewidget(client),
|
||||
},
|
||||
buttons = buttons,
|
||||
layout = lflex.horizontal,
|
||||
},
|
||||
{ -- Right
|
||||
atitlebar.widget.floatingbutton(client),
|
||||
atitlebar.widget.maximizedbutton(client),
|
||||
atitlebar.widget.stickybutton(client),
|
||||
atitlebar.widget.ontopbutton(client),
|
||||
atitlebar.widget.closebutton(client),
|
||||
layout = lfixed.horizontal(),
|
||||
},
|
||||
layout = lalign.horizontal,
|
||||
}
|
||||
titlebar(client)
|
||||
end
|
||||
|
||||
function slots.naughty_display(notification)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
local nice = require "awesome-wm-nice"
|
||||
|
||||
local titlebar = { mt = {} }
|
||||
|
||||
function titlebar.new(client)
|
||||
-- We need first to manually set the base color because of how nice is designed
|
||||
client._nice_base_color = nice.config.titlebar_color
|
||||
|
||||
nice.add_window_decoration(client)
|
||||
nice.apply_client_shape(client)
|
||||
end
|
||||
|
||||
function titlebar.mt:__call(client)
|
||||
return titlebar.new(client)
|
||||
end
|
||||
|
||||
return setmetatable(titlebar, titlebar.mt)
|
Loading…
Reference in New Issue