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
39 -- Borders are factored in.
40 wa.height = wa.height - (global_border * 2)
41 wa.width = wa.width - (global_border * 2)
42 wa.x = wa.x + global_border
43 wa.y = wa.y + global_border
45 -- Width of main column?
46 local t = awful.tag.selected(p.screen)
47 local mwfact = awful.tag.getmwfact(t)
51 -- Main column, fixed width and height.
54 local mainwid = math.floor(wa.width * mwfact)
55 local slavewid = wa.width - mainwid
56 local slaveLwid = math.floor(slavewid / 2)
57 local slaveRwid = slavewid - slaveLwid
58 local slaveThei = math.floor(wa.height / 2)
59 local slaveBhei = wa.height - slaveThei
60 local Thalfgap = math.floor(useless_gap / 2)
61 local Bhalfgap = useless_gap - Thalfgap
63 g.height = wa.height - 2*useless_gap - 2*c.border_width
64 g.width = mainwid - 2*c.border_width
65 g.x = wa.x + slaveLwid
66 g.y = wa.y + useless_gap
68 if g.width < 1 then g.width = 1 end
69 if g.height < 1 then g.height = 1 end
78 -- It's all fixed. If there are more than 5 clients,
79 -- those additional clients will float. This is
89 if i - 2 == centerwork.top_left
92 g.x = wa.x + useless_gap
93 g.y = wa.y + useless_gap
94 g.width = slaveLwid - 2*useless_gap - 2*c.border_width
95 g.height = slaveThei - useless_gap - Thalfgap - 2*c.border_width
96 elseif i - 2 == centerwork.top_right
99 g.x = wa.x + slaveLwid + mainwid + useless_gap
100 g.y = wa.y + useless_gap
101 g.width = slaveRwid - 2*useless_gap - 2*c.border_width
102 g.height = slaveThei - useless_gap - Thalfgap - 2*c.border_width
103 elseif i - 2 == centerwork.bottom_left
106 g.x = wa.x + useless_gap
107 g.y = wa.y + slaveThei + Bhalfgap
108 g.width = slaveLwid - 2*useless_gap - 2*c.border_width
109 g.height = slaveBhei - useless_gap - Bhalfgap - 2*c.border_width
110 elseif i - 2 == centerwork.bottom_right
113 g.x = wa.x + slaveLwid + mainwid + useless_gap
114 g.y = wa.y + slaveThei + Bhalfgap
115 g.width = slaveRwid - 2*useless_gap - 2*c.border_width
116 g.height = slaveBhei - useless_gap - Bhalfgap - 2*c.border_width
119 if g.width < 1 then g.width = 1 end
120 if g.height < 1 then g.height = 1 end
126 -- Set remaining clients to floating.
127 for i = (#cls - 1 - 4),1,-1
130 awful.client.floating.set(c, true)