Compare commits

...

4 Commits

Author SHA1 Message Date
Aire-One 3068a54115 add(CLIENT_SHAPE) slot 2022-02-20 19:56:19 +01:00
Aire-One ebd9b740b8 add(theme) border_width 2022-02-20 19:21:39 +01:00
Aire-One a74a0ec702 add(CLIENT_TITLEBAR) slot and ui component 2022-02-20 19:21:13 +01:00
Aire-One fc3928923d add(rc) nice module 2022-02-20 19:11:57 +01:00
4 changed files with 53 additions and 40 deletions

View File

@ -123,7 +123,24 @@ local client_titlebar = slot {
connect = true,
target = capi.client,
signal = "request::titlebars",
slot = my_slots.build_client_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 client_shape
local client_shape = slot {
id = "CLIENT_SHAPE",
connect = true,
target = capi.client,
signal = "request::manage",
slot = my_slots.client_shape,
}
-- luacheck: ignore unused variable ruled_notification

View File

@ -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,41 +73,21 @@ 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.client_shape(client)
local beautiful = require "beautiful"
local nice_shapes = require "awesome-wm-nice.shapes"
client.shape = nice_shapes.rounded_rect {
tl = beautiful.client_corner_radius_top,
tr = beautiful.client_corner_radius_top,
bl = beautiful.client_corner_radius_bottom,
br = beautiful.client_corner_radius_bottom,
}
end

View File

@ -9,6 +9,11 @@ local theme = {}
--- Basic
theme.font = "Noto Mono 9"
theme.border_width = 0
--- Clients
theme.client_corner_radius_top = 9
theme.client_corner_radius_bottom = 4
--- Tags
theme.hometag_master_width_factor = 0.65

16
ui/titlebar/init.lua Normal file
View File

@ -0,0 +1,16 @@
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)
end
function titlebar.mt:__call(client)
return titlebar.new(client)
end
return setmetatable(titlebar, titlebar.mt)