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
7 * (c) 2009 Uli Schlachter
8 * (c) 2008 Julien Danjolu
12 local beautiful = require("beautiful")
14 local tonumber = tonumber
15 local math = require("math")
16 local naughty = require("naughty")
18 local uselesspiral = {}
20 local function spiral(p, spiral)
21 -- A useless gap (like the dwm patch) can be defined with
22 -- beautiful.useless_gap_width.
23 local useless_gap = tonumber(beautiful.useless_gap_width) or 0
24 if useless_gap < 0 then useless_gap = 0 end
26 -- A global border can be defined with
27 -- beautiful.global_border_width
28 local global_border = tonumber(beautiful.global_border_width) or 0
29 if global_border < 0 then global_border = 0 end
31 -- Themes border width requires an offset
32 local bw = tonumber(beautiful.border_width) or 0
34 -- get our orientation right
37 local n = #cls -- number of windows total; k = which window number
39 wa.height = wa.height - ((global_border * 2) + (bw * 2))
40 wa.width = wa.width - ((global_border * 2) + (bw * 2))
44 for k, c in ipairs(cls) do
47 wa.height = (wa.height / 2)
49 wa.width = (wa.width / 2)
53 if k % 4 == 0 and spiral then
54 wa.x = wa.x - wa.width
56 (k % 4 == 3 and k < n and spiral) then
57 wa.x = wa.x + wa.width
60 if k % 4 == 1 and k ~= 1 and spiral then
61 wa.y = wa.y - wa.height
62 elseif k % 2 == 1 and k ~= 1 or
63 (k % 4 == 0 and k < n and spiral) then
64 wa.y = wa.y + wa.height
68 wa2.x = wa.x + (useless_gap / 2) + global_border
69 wa2.y = wa.y + (useless_gap / 2) + global_border
70 wa2.height = wa.height - (useless_gap / 2)
71 wa2.width = wa.width - (useless_gap / 2)
76 -- Top and left clients are shrinked by two steps and
77 -- get moved away from the border. Other clients just
78 -- get shrinked in one direction.
83 if wa2.y == static_wa.y then
87 if wa2.x == static_wa.x then
92 wa2.height = wa2.height - useless_gap
93 wa2.y = wa2.y - (useless_gap / 2)
95 wa2.height = wa2.height - (useless_gap / 2)
99 wa2.width = wa2.width - useless_gap
100 wa2.x = wa2.x - (useless_gap / 2)
102 wa2.width = wa2.width - (useless_gap / 2)
105 -- End of useless gap.
112 uselesspiral.dwindle = {}
113 uselesspiral.dwindle.name = "uselessdwindle"
114 function uselesspiral.dwindle.arrange(p)
115 return spiral(p, false)
119 uselesspiral.name = "uselesspiral"
120 function uselesspiral.arrange(p)
121 return spiral(p, true)