Add mwfact resizing to spiral layout

This commit is contained in:
MorellThomas 2024-08-25 09:34:17 +02:00
parent 67f5e7feca
commit 011736c7e2
1 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,7 @@
-- Grab environment we need -- Grab environment we need
local ipairs = ipairs local ipairs = ipairs
local math = math local math = math
local tag = require("awful.tag")
--- The spiral layout layoutbox icon. --- The spiral layout layoutbox icon.
-- @beautiful beautiful.layout_spiral -- @beautiful beautiful.layout_spiral
@ -25,13 +26,22 @@ local math = math
local spiral = {} local spiral = {}
local function do_spiral(p, is_spiral) local function do_spiral(p, is_spiral)
local t = p.tag or screen[p.screen].selected_tag
local wa = p.workarea local wa = p.workarea
local cls = p.clients local cls = p.clients
local n = #cls local n = #cls
local old_width, old_height = wa.width, 2 * wa.height local old_width, old_height = wa.width, 2 * wa.height
local mwfact = t.master_width_factor + 0.5
for k, c in ipairs(cls) do for k, c in ipairs(cls) do
if k % 2 == 0 then if k == 1 and n ~= 1 then
wa.width, old_width = math.floor((wa.width / 2) * mwfact), wa.width
elseif k == 2 then
wa.width, old_width = math.ceil((old_width / 2) * (2 - mwfact)), wa.width
if k ~= n then
wa.height, old_height = math.floor(wa.height / 2), wa.height
end
elseif k % 2 == 0 then
wa.width, old_width = math.ceil(old_width / 2), wa.width wa.width, old_width = math.ceil(old_width / 2), wa.width
if k ~= n then if k ~= n then
wa.height, old_height = math.floor(wa.height / 2), wa.height wa.height, old_height = math.floor(wa.height / 2), wa.height