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
5 * (c) 2013, Luke Bonham
6 * (c) 2010-2012, Peter Hofmann
10 local tag = require("awful.tag")
11 local beautiful = require("beautiful")
12 local tonumber = tonumber
25 function cascadetile.arrange(p)
27 -- Layout with one fixed column meant for a master window. Its
28 -- width is calculated according to mwfact. Other clients are
29 -- cascaded or "tabbed" in a slave column on the right.
31 -- It's a bit hard to demonstrate the behaviour with ASCII-images...
34 -- +-----+---+ +-----+---+ +-----+---+ +-----+---+
35 -- | | | | | | | | | | | 4 |
36 -- | | | | | 2 | | | 3 | | | |
37 -- | 1 | | -> | 1 | | -> | 1 | | -> | 1 +---+
38 -- | | | | +---+ | +---+ | | 3 |
39 -- | | | | | | | | 2 | | |---|
40 -- | | | | | | | |---| | | 2 |
41 -- | | | | | | | | | | |---|
42 -- +-----+---+ +-----+---+ +-----+---+ +-----+---+
44 -- A useless gap (like the dwm patch) can be defined with
45 -- beautiful.useless_gap_width.
46 local useless_gap = tonumber(beautiful.useless_gap_width)
56 -- Width of main column?
57 local t = tag.selected(p.screen)
59 if cascadetile.mwfact > 0
61 mwfact = cascadetile.mwfact
63 mwfact = tag.getmwfact(t)
66 -- Make slave windows overlap main window? Do this if ncol is 1.
68 if cascadetile.ncol > 0
70 overlap_main = cascadetile.ncol
72 overlap_main = tag.getncol(t)
75 -- Minimum space for slave windows? See cascade.lua.
77 if cascadetile.nmaster > 0
79 num_c = cascadetile.nmaster
81 num_c = tag.getnmaster(t)
84 local how_many = #cls - 1
89 local current_offset_x = cascadetile.offset_x * (how_many - 1)
90 local current_offset_y = cascadetile.offset_y * (how_many - 1)
94 -- Main column, fixed width and height.
97 local mainwid = wa.width * mwfact
98 local slavewid = wa.width - mainwid
104 -- The size of the main window may be reduced a little bit.
105 -- This allows you to see if there are any windows below the
107 -- This only makes sense, though, if the main window is
108 -- overlapping everything else.
109 g.width = g.width - cascadetile.extra_padding
119 -- Reduce width once and move window to the right. Reduce
120 -- height twice, however.
121 g.width = g.width - useless_gap
122 g.height = g.height - 2 * useless_gap
123 g.x = g.x + useless_gap
124 g.y = g.y + useless_gap
126 -- When there's no window to the right, add an additional
130 g.width = g.width - useless_gap
135 -- Remaining clients stacked in slave column, new ones on top.
138 for i = (#cls - 1),1,-1
142 g.width = slavewid - current_offset_x
143 g.height = wa.height - current_offset_y
144 g.x = wa.x + mainwid + (how_many - i) * cascadetile.offset_x
145 g.y = wa.y + (i - 1) * cascadetile.offset_y
148 g.width = g.width - 2 * useless_gap
149 g.height = g.height - 2 * useless_gap
150 g.x = g.x + useless_gap
151 g.y = g.y + useless_gap