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) 2010-2012, Peter Hofmann
11 local awful = require("awful")
12 local beautiful = require("beautiful")
13 local tonumber = tonumber
14 local math = { floor = math.floor }
25 function centerwork.arrange(p)
26 -- A useless gap (like the dwm patch) can be defined with
27 -- beautiful.useless_gap_width .
28 local useless_gap = tonumber(beautiful.useless_gap_width) or 0
30 -- A global border can be defined with
31 -- beautiful.global_border_width
32 local global_border = tonumber(beautiful.global_border_width) or 0
33 if global_border < 0 then global_border = 0 end
35 -- Themes border width requires an offset
36 local bw = tonumber(beautiful.border_width) or 0
42 -- Borders are factored in.
43 wa.height = wa.height - (global_border * 2)
44 wa.width = wa.width - (global_border * 2)
46 -- Width of main column?
47 local t = awful.tag.selected(p.screen)
48 local mwfact = awful.tag.getmwfact(t)
52 -- Main column, fixed width and height.
55 local mainwid = math.floor(wa.width * mwfact)
56 local slavewid = wa.width - mainwid
57 local slaveLwid = math.floor(slavewid / 2)
58 local slaveRwid = slavewid - slaveLwid
59 local slaveThei = math.floor(wa.height / 2)
60 local slaveBhei = wa.height - slaveThei
62 g.height = wa.height - 2*useless_gap - 2*bw
63 g.width = mainwid - 2*bw
64 g.x = wa.x + slaveLwid + global_border
65 g.y = wa.y + useless_gap + global_border
75 -- It's all fixed. If there are more than 5 clients,
76 -- those additional clients will float. This is
86 if i - 2 == centerwork.top_left
89 g.x = wa.x + useless_gap + global_border
90 g.y = wa.y + useless_gap + global_border
91 g.width = slaveLwid - 2*useless_gap - 2*bw
92 g.height = slaveThei - useless_gap - 2*bw
93 elseif i - 2 == centerwork.top_right
96 g.x = wa.x + slaveLwid + mainwid + useless_gap + global_border
97 g.y = wa.y + useless_gap + global_border
98 g.width = slaveRwid - 2*useless_gap - 2*bw
99 g.height = slaveThei - useless_gap - 2*bw
100 elseif i - 2 == centerwork.bottom_left
103 g.x = wa.x + useless_gap + global_border
104 g.y = wa.y + slaveThei + useless_gap + global_border
105 g.width = slaveLwid - 2*useless_gap - 2*bw
106 g.height = slaveBhei - 2*useless_gap - 2*bw
107 elseif i - 2 == centerwork.bottom_right
110 g.x = wa.x + slaveLwid + mainwid + useless_gap + global_border
111 g.y = wa.y + slaveThei + useless_gap + global_border
112 g.width = slaveRwid - 2*useless_gap - 2*bw
113 g.height = slaveBhei - 2*useless_gap - 2*bw
121 -- Set remaining clients to floating.
122 for i = (#cls - 1 - 4),1,-1
125 awful.client.floating.set(c, true)