All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 Licensed under GNU General Public License v2
6 * (c) 2013, Luke Bonham
7 * (c) 2009, Uli Schlachter
8 * (c) 2008, Julien Danjolu
12 local beautiful = require("beautiful")
14 local tonumber = tonumber
15 local math = require("math")
17 local uselesspiral = {}
19 local function spiral(p, spiral)
20 -- A useless gap (like the dwm patch) can be defined with
21 -- beautiful.useless_gap_width.
22 local useless_gap = tonumber(beautiful.useless_gap_width) or 0
23 if useless_gap < 0 then useless_gap = 0 end
25 -- A global border can be defined with
26 -- beautiful.global_border_width
27 local global_border = tonumber(beautiful.global_border_width) or 0
28 if global_border < 0 then global_border = 0 end
30 -- Themes border width requires an offset
31 local bw = tonumber(beautiful.border_width) or 0
33 -- get our orientation right
36 local n = #cls -- number of windows total; k = which window number
38 wa.height = wa.height - ((global_border * 2) + (bw * 2))
39 wa.width = wa.width - ((global_border * 2) + (bw * 2))
43 for k, c in ipairs(cls) do
46 wa.height = (wa.height / 2)
48 wa.width = (wa.width / 2)
52 if k % 4 == 0 and spiral then
53 wa.x = wa.x - wa.width
55 (k % 4 == 3 and k < n and spiral) then
56 wa.x = wa.x + wa.width
59 if k % 4 == 1 and k ~= 1 and spiral then
60 wa.y = wa.y - wa.height
61 elseif k % 2 == 1 and k ~= 1 or
62 (k % 4 == 0 and k < n and spiral) then
63 wa.y = wa.y + wa.height
67 wa2.x = wa.x + (useless_gap / 2) + global_border
68 wa2.y = wa.y + (useless_gap / 2) + global_border
69 wa2.height = wa.height - (useless_gap / 2)
70 wa2.width = wa.width - (useless_gap / 2)
75 -- Top and left clients are shrinked by two steps and
76 -- get moved away from the border. Other clients just
77 -- get shrinked in one direction.
82 if wa2.y == static_wa.y then
86 if wa2.x == static_wa.x then
91 wa2.height = wa2.height - useless_gap
92 wa2.y = wa2.y - (useless_gap / 2)
94 wa2.height = wa2.height - (useless_gap / 2)
98 wa2.width = wa2.width - useless_gap
99 wa2.x = wa2.x - (useless_gap / 2)
101 wa2.width = wa2.width - (useless_gap / 2)
104 -- End of useless gap.
111 uselesspiral.dwindle = {}
112 uselesspiral.dwindle.name = "uselessdwindle"
113 function uselesspiral.dwindle.arrange(p)
114 return spiral(p, false)
118 uselesspiral.name = "uselesspiral"
119 function uselesspiral.arrange(p)
120 return spiral(p, true)