chore: remove unecessary max screen dims

This commit is contained in:
Aire-One 2021-12-10 22:38:55 +01:00
parent 516c3abbe0
commit cd684593f7
1 changed files with 5 additions and 17 deletions

View File

@ -100,8 +100,6 @@ local nice = {}
-- => Defaults -- => Defaults
-- ============================================================ -- ============================================================
local _private = {} local _private = {}
_private.max_width = 0
_private.max_height = 0
-- Titlebar -- Titlebar
_private.titlebar_height = 38 _private.titlebar_height = 38
@ -658,6 +656,8 @@ end
-- Puts all the pieces together and decorates the given client -- Puts all the pieces together and decorates the given client
function _private.add_window_decorations(c) function _private.add_window_decorations(c)
local client_color = c._nice_base_color local client_color = c._nice_base_color
local client_geometry = c:geometry()
-- Closures to avoid repitition -- Closures to avoid repitition
local lighten = function(amount) local lighten = function(amount)
return color_lighten(client_color, amount) return color_lighten(client_color, amount)
@ -726,7 +726,7 @@ function _private.add_window_decorations(c)
stroke_offset_outer = 0.5, stroke_offset_outer = 0.5,
stroke_width_inner = 2, stroke_width_inner = 2,
stroke_width_outer = 1, stroke_width_outer = 1,
width = _private.max_width, width = client_geometry.width,
} }
-- Create the titlebar -- Create the titlebar
local titlebar = awful.titlebar( local titlebar = awful.titlebar(
@ -771,7 +771,7 @@ function _private.add_window_decorations(c)
-- The left side border -- The left side border
local left_border_img = create_edge_left { local left_border_img = create_edge_left {
client_color = client_color, client_color = client_color,
height = _private.max_height, height = client_geometry.height,
stroke_offset_outer = 0.5, stroke_offset_outer = 0.5,
stroke_width_outer = 1, stroke_width_outer = 1,
stroke_color_outer = stroke_color_outer_sides, stroke_color_outer = stroke_color_outer_sides,
@ -843,7 +843,7 @@ function _private.add_window_decorations(c)
stroke_offset_outer = 0.5, stroke_offset_outer = 0.5,
stroke_width_inner = 1, stroke_width_inner = 1,
stroke_width_outer = 1, stroke_width_outer = 1,
width = _private.max_width, width = client_geometry.width,
}, },
"vertical" "vertical"
) )
@ -894,16 +894,6 @@ function _private.add_window_decorations(c)
collectgarbage "collect" collectgarbage "collect"
end end
local function update_max_screen_dims()
local max_height, max_width = 0, 0
for s in _G.screen do
max_height = max(max_height, s.geometry.height)
max_width = max(max_width, s.geometry.width)
end
_private.max_height = max_height * 1.5
_private.max_width = max_width * 1.5
end
local function validate_mb_bindings() local function validate_mb_bindings()
local action_mbs = { local action_mbs = {
"mb_move", "mb_move",
@ -936,8 +926,6 @@ local function validate_mb_bindings()
end end
function nice.initialize(args) function nice.initialize(args)
update_max_screen_dims()
_G.screen.connect_signal("list", update_max_screen_dims)
local crush = require("gears.table").crush local crush = require("gears.table").crush
local table_args = { local table_args = {
titlebar_items = true, titlebar_items = true,