Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add mwfact resizing to spiral layout #3945

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/awful/layout/suit/spiral.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
-- Grab environment we need
local ipairs = ipairs
local math = math
local capi = { screen = screen }

--- The spiral layout layoutbox icon.
-- @beautiful beautiful.layout_spiral
Expand All @@ -25,13 +26,22 @@ local math = math
local spiral = {}

local function do_spiral(p, is_spiral)
local t = p.tag or capi.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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why + 0.5?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nessecary for it the default to behave as it did before this patch. Without changing the mwfact by pressing the key, the windows are split in the center of the screen. Without adding + 0.5, the default center would have the left window occupy only a small part on the left of the screen and it cannot be resized until the right side.


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
Expand Down
Loading