From 011736c7e2a235ad8d3d2e461505a31e150b7c5c Mon Sep 17 00:00:00 2001 From: MorellThomas Date: Sun, 25 Aug 2024 09:34:17 +0200 Subject: [PATCH 1/2] Add mwfact resizing to spiral layout --- lib/awful/layout/suit/spiral.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/awful/layout/suit/spiral.lua b/lib/awful/layout/suit/spiral.lua index fe608dfa23..e5005097dd 100644 --- a/lib/awful/layout/suit/spiral.lua +++ b/lib/awful/layout/suit/spiral.lua @@ -11,6 +11,7 @@ -- Grab environment we need local ipairs = ipairs local math = math +local tag = require("awful.tag") --- The spiral layout layoutbox icon. -- @beautiful beautiful.layout_spiral @@ -25,13 +26,22 @@ local math = math local spiral = {} local function do_spiral(p, is_spiral) + local t = p.tag or screen[p.screen].selected_tag local wa = p.workarea local cls = p.clients local n = #cls 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 - 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 if k ~= n then wa.height, old_height = math.floor(wa.height / 2), wa.height From 4b0779451d4e7dd05cb17ac7356bcd7271fb958e Mon Sep 17 00:00:00 2001 From: MorellThomas Date: Sun, 25 Aug 2024 14:34:02 +0200 Subject: [PATCH 2/2] Update comments from pull request --- lib/awful/layout/suit/spiral.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/awful/layout/suit/spiral.lua b/lib/awful/layout/suit/spiral.lua index e5005097dd..45da66955d 100644 --- a/lib/awful/layout/suit/spiral.lua +++ b/lib/awful/layout/suit/spiral.lua @@ -11,7 +11,7 @@ -- Grab environment we need local ipairs = ipairs local math = math -local tag = require("awful.tag") +local capi = { screen = screen } --- The spiral layout layoutbox icon. -- @beautiful beautiful.layout_spiral @@ -26,7 +26,7 @@ local tag = require("awful.tag") local spiral = {} local function do_spiral(p, is_spiral) - local t = p.tag or screen[p.screen].selected_tag + local t = p.tag or capi.screen[p.screen].selected_tag local wa = p.workarea local cls = p.clients local n = #cls