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 tag = require("awful.tag")
12 local beautiful = require("beautiful")
13 local tonumber = tonumber
26 function cascadetile.arrange(p)
28 -- Layout with one fixed column meant for a master window. Its
29 -- width is calculated according to mwfact. Other clients are
30 -- cascaded or "tabbed" in a slave column on the right.
32 -- It's a bit hard to demonstrate the behaviour with ASCII-images...
35 -- +----------+---+ +----------+---+ +----------+---+ +----------+---+
36 -- | | | | | 3 | | | 4 | | +---+|
37 -- | | | -> | | | -> | +---++ -> | +---+|+
38 -- | 1 | 2 | | 1 +---++ | 1 | 3 || | 1 +---+|+|
39 -- | | | | | 2 || | +---++| | +---+|+ |
40 -- | | | | | || | | 2 | | | | 2 |+ |
41 -- +----------+---+ +---------+---++ +--------+---+-+ +------+---+---+
43 -- A useless gap (like the dwm patch) can be defined with
44 -- beautiful.useless_gap_width.
45 local useless_gap = tonumber(beautiful.useless_gap_width) or 0
46 if useless_gap < 0 then useless_gap = 0 end
48 -- A global border can be defined with
49 -- beautiful.global_border_width
50 local global_border = tonumber(beautiful.global_border_width) or 0
51 if global_border < 0 then global_border = 0 end
57 -- Borders are factored in.
58 wa.height = wa.height - (global_border * 2)
59 wa.width = wa.width - (global_border * 2)
61 -- Width of main column?
62 local t = tag.selected(p.screen)
64 if cascadetile.mwfact > 0
66 mwfact = cascadetile.mwfact
68 mwfact = tag.getmwfact(t)
71 -- Make slave windows overlap main window? Do this if ncol is 1.
73 if cascadetile.ncol > 0
75 overlap_main = cascadetile.ncol
77 overlap_main = tag.getncol(t)
80 -- Minimum space for slave windows? See cascade.lua.
82 if cascadetile.nmaster > 0
84 num_c = cascadetile.nmaster
86 num_c = tag.getnmaster(t)
89 local how_many = #cls - 1
94 local current_offset_x = cascadetile.offset_x * (how_many - 1)
95 local current_offset_y = cascadetile.offset_y * (how_many - 1)
99 -- Main column, fixed width and height.
102 -- Subtracting the useless_gap width from the work area width here
103 -- makes this mwfact calculation work the same as in uselesstile.
104 -- Explicitly rounding is necessary to prevent the rendered size of
105 -- slavewid from changing depending on whether we round up or down.
106 local mainwid = math.floor((wa.width - useless_gap) * mwfact)
107 local slavewid = wa.width - mainwid
111 g.width = wa.width - 2*c.border_width
113 -- The size of the main window may be reduced a little bit.
114 -- This allows you to see if there are any windows below the
116 -- This only makes sense, though, if the main window is
117 -- overlapping everything else.
118 g.width = g.width - cascadetile.extra_padding
120 g.width = mainwid - 2*c.border_width
123 g.height = wa.height - 2*c.border_width
124 g.x = wa.x + global_border
125 g.y = wa.y + global_border
128 -- Reduce width once and move window to the right. Reduce
129 -- height twice, however.
130 g.width = g.width - useless_gap
131 g.height = g.height - 2 * useless_gap
132 g.x = g.x + useless_gap
133 g.y = g.y + useless_gap
135 -- When there's no window to the right, add an additional
139 g.width = g.width - useless_gap
144 -- Remaining clients stacked in slave column, new ones on top.
151 g.width = slavewid - current_offset_x - 2*c.border_width
152 g.height = wa.height - current_offset_y - 2*c.border_width
153 g.x = wa.x + mainwid + (how_many - (i - 1)) * cascadetile.offset_x + global_border
154 g.y = wa.y + (i - 2) * cascadetile.offset_y + global_border
157 g.width = g.width - 2 * useless_gap
158 g.height = g.height - 2 * useless_gap
159 g.x = g.x + useless_gap
160 g.y = g.y + useless_gap