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) or 0
52 -- Width of main column?
53 local t = tag.selected(p.screen)
55 if cascadetile.mwfact > 0
57 mwfact = cascadetile.mwfact
59 mwfact = tag.getmwfact(t)
62 -- Make slave windows overlap main window? Do this if ncol is 1.
64 if cascadetile.ncol > 0
66 overlap_main = cascadetile.ncol
68 overlap_main = tag.getncol(t)
71 -- Minimum space for slave windows? See cascade.lua.
73 if cascadetile.nmaster > 0
75 num_c = cascadetile.nmaster
77 num_c = tag.getnmaster(t)
80 local how_many = #cls - 1
85 local current_offset_x = cascadetile.offset_x * (how_many - 1)
86 local current_offset_y = cascadetile.offset_y * (how_many - 1)
90 -- Main column, fixed width and height.
93 local mainwid = wa.width * mwfact
94 local slavewid = wa.width - mainwid
100 -- The size of the main window may be reduced a little bit.
101 -- This allows you to see if there are any windows below the
103 -- This only makes sense, though, if the main window is
104 -- overlapping everything else.
105 g.width = g.width - cascadetile.extra_padding
115 -- Reduce width once and move window to the right. Reduce
116 -- height twice, however.
117 g.width = g.width - useless_gap
118 g.height = g.height - 2 * useless_gap
119 g.x = g.x + useless_gap
120 g.y = g.y + useless_gap
122 -- When there's no window to the right, add an additional
126 g.width = g.width - useless_gap
131 -- Remaining clients stacked in slave column, new ones on top.
134 for i = (#cls - 1),1,-1
138 g.width = slavewid - current_offset_x
139 g.height = wa.height - current_offset_y
140 g.x = wa.x + mainwid + (how_many - i) * cascadetile.offset_x
141 g.y = wa.y + (i - 1) * cascadetile.offset_y
144 g.width = g.width - 2 * useless_gap
145 g.height = g.height - 2 * useless_gap
146 g.x = g.x + useless_gap
147 g.y = g.y + useless_gap