layout: spiral: remove useless local variables
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
7ae072b791
commit
391e3ea954
|
@ -13,38 +13,32 @@ module("awful.layout.suit.spiral")
|
|||
local function spiral(p, spiral)
|
||||
local wa = p.workarea
|
||||
local cls = p.clients
|
||||
|
||||
local n = #cls
|
||||
local nx = wa.x
|
||||
local ny = wa.y
|
||||
local nw = wa.width
|
||||
local nh = wa.height
|
||||
|
||||
for k, c in ipairs(cls) do
|
||||
if k < n then
|
||||
if k % 2 == 0 then
|
||||
nh = nh / 2
|
||||
wa.height = wa.height / 2
|
||||
else
|
||||
nw = nw / 2
|
||||
wa.width = wa.width / 2
|
||||
end
|
||||
end
|
||||
|
||||
if k % 4 == 0 and spiral then
|
||||
nx = nx - nw
|
||||
wa.x = wa.x - wa.width
|
||||
elseif k % 2 == 0 or
|
||||
(k % 4 == 3 and k < n and spiral) then
|
||||
nx = nx + nw
|
||||
wa.x = wa.x + wa.width
|
||||
end
|
||||
|
||||
if k % 4 == 1 and k ~= 1 and spiral then
|
||||
ny = ny - nh
|
||||
wa.y = wa.y - wa.height
|
||||
elseif k % 2 == 1 and k ~= 1 or
|
||||
(k % 4 == 0 and k < n and spiral) then
|
||||
ny = ny + nh
|
||||
wa.y = wa.y + wa.height
|
||||
end
|
||||
|
||||
local geom = { x = nx, y = ny, width = nw, height = nh }
|
||||
c:geometry(geom)
|
||||
c:geometry(wa)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue