Skip to content

Commit 7c4420a

Browse files
committed
FvwmRearrange, update to changes in fvwm3 1.1.1.
1 parent 31ad18e commit 7c4420a

File tree

1 file changed

+184
-37
lines changed

1 file changed

+184
-37
lines changed

Wiki/Modules/FvwmRearrange/index.md

Lines changed: 184 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,81 +7,228 @@ description: |
77
---
88
# FvwmRearrange
99

10+
<div class="alert alert-warning text-dark">
11+
FvwmRerrange options changed in fvwm3 1.1.1, below only
12+
applies to that version and newer. For older versions
13+
refer to the manual page for the options.
14+
</div>
15+
1016
* TOC
1117
{:toc}
1218

1319
This module can be called to tile or cascade windows.
1420

15-
When tiling the module attempts to tile windows on the current
16-
screen subject to certain constraints. Horizontal or vertical tiling
17-
is performed so that each window does not overlap another,
18-
and by default each window is resized to its nearest
19-
resize increment (note sometimes some space might appear between
20-
tiled windows -- this is why).
21+
When tiling the module rearranges all the windows on the current
22+
monitor into a grid (or matrix). By default FvwmRearrange will
23+
tile the windows into a grid that is close to a square grid as
24+
possible based on the number of windows on the monitor. The size
25+
(and direction) of the grid can be configured using various options.
2126

22-
When cascading the module attempts to cascade windows on the
23-
current screen subject to certain constraints. Layering is performed
24-
so consecutive windows will have their window titles visible underneath
25-
the previous.
27+
When cascading the module will resize (to 75% the size of the monitor)
28+
then place them starting from the top left of the monitor, and place
29+
each window down and to the left of the previous window so its title
30+
bar and borders can be seen behind it. Both the size windows are
31+
resized to and the size of the increments can be configured using
32+
various options.
2633

2734
## Configuration and Use
2835

29-
FvwmRearrange is invoked from a menu, pop-up, or button. Several
30-
command line options can be used to constrain the layering. For a full
31-
list of FvwmRearrange configuration options see the FvwmRearrange manpage.
36+
FvwmRearrange is a module that must be invoked from fvwm. It can be
37+
add to a menu, key binding, event, and so on. FvwmRearrange is configured
38+
using command line options (all with a single `-`). These options affect
39+
the placement, resizing, ordering of windows and so on. For a full list
40+
of FvwmRearrange configuration options see the FvwmRearrange manpage.
3241

33-
Here is a sample configuration for tiling with 2 columns.
42+
The simplest way to run FvwmRerrange is with no options, which
43+
will auto tile (the same as the `-auto_tile` option) the windows
44+
on the current monitor. You can additionally specify a specific
45+
monitor to rearrange, and how to order the windows. For example
46+
to auto tile all the windows and order them by their class in
47+
reverse alphabetical order on the RandR monitor `DP-2` use:
3448

3549
{% fvwm2rc %}
36-
FvwmRearrange -tile -r -mn 2 -maximize 0 0
50+
FvwmRearrange -screen DP-2 -order_class -reverse
3751
{% endfvwm2rc %}
3852

39-
To restore the windows, FvwmRearrange doesn't reverse the options,
40-
use this for all.
53+
By default FvwmRerrange cannot restore the position of the windows.
54+
If you want to be able to return windows to their original position
55+
you can by including the `-maximze` option (note this only works on
56+
windows which are not already in the maximized state), which will put
57+
all the windows into a maximized state. This allows you to return the
58+
window to its original position by unmaximizing them. For example:
4159

4260
{% fvwm2rc %}
61+
# Auto tile all windows on RandR monitor DP-2
62+
FvwmRearrange -screen DP-2 -maximize
63+
64+
# Restore the windows original position
4365
All (CurrentPage, !Iconic, CirculateHit, !Sticky) Maximize Off
4466
{% endfvwm2rc %}
4567

46-
## Example
68+
## Tiling Windows
69+
70+
Tiling windows will place them in a grid, whose size can be controlled
71+
using various options. By default FvwmRerrange will use an auto tile mode
72+
which will compute a grid that is as close to a square as possible depending
73+
on the number of windows available. For instance if you have 6 windows, a
74+
2x2 grid is too small, while a 3x3 grid is too big, so a 3x2 grid will be
75+
used instead (if the option `-swap` is included the grid will be 2x3).
76+
77+
If the number of windows doesn't match the size of the grid some cells are
78+
initially empty, for example if there are only 5 windows and a 3x2 grid is
79+
used, one cell of the grid is left empty. In auto tile mode the option
80+
`-fill_start` is implied, which will fill the first row (or column if `-swap`
81+
is used) with the first two windows, and then place the remaining 3 windows
82+
on the second row using all the space. The option `-fill_end` can be used to
83+
instead fill the first row with the first three windows, then fill the last
84+
row with the remaining two windows.
85+
86+
The size of the grid can be controlled in various ways. If using auto tile
87+
mode, the option `-max_n N` can be used to offset the size of the grid, by
88+
stating how many more columns (or rows with `-swap`) the final grid must
89+
have. For example `-max_n 2` will mean there is always at least two more
90+
columns than rows, so 5-8 windows will cause a 4x2 grid (or a 2x4 grid with
91+
`-swap`). For more control of the grid use the `-tile` option, which will
92+
put all windows into a single row (or column with `-swap`). If you combine
93+
`-tile` with `-max_n N`, then you can specify the maximum number of columns
94+
(or rows). For example `-tile -max_n 3` will tile the windows so there is at
95+
most three columns, and the number of rows is based off the number of windows
96+
tiled. By default `-tile` will leave cells empty unless the `-fill_start` or
97+
`-fill_end` option is included.
98+
99+
Last, windows are resized to fit into their respective cells subject to
100+
EWMH size hints. That means windows like terminals that include hints to
101+
only allowing resizing by specific increments (equal to the size of a single
102+
character in terminals) may not completely fill their cell leaving gaps. If
103+
you want to override this behavior, tell fvwm to ignore resize hints using
104+
the following style:
105+
106+
{% fvwm2rc %}
107+
Style * ResizeHintOverride
108+
{% endfvwm2rc %}
109+
110+
## Cascading Windows
111+
112+
FvwmRerrange can be used to cascade windows using the `-cascade` option.
113+
This option mimics the fvwm `CascadePlacement` style where windows are placed
114+
starting in the upper left corner of the monitor, placing each window on top
115+
of the previous window shifted down and to the left so the title bar and
116+
border of the previous window is seen behind it.
117+
118+
By default FvwmRerrange will resize the windows to be 75% the size of the
119+
current monitor. The option `-noresize` can be used to prevent FvwmRearrange
120+
from resizing the windows, while the option `-nostretch` will prevent
121+
FvwmRerrange from making windows bigger, but will shrink them to fit if they
122+
are too big. The options `-cascadew X` and `-cascadeh Y` can be used to
123+
specify the width and height of the windows. `X` and `Y` are taken to be
124+
percent of the bounding box, or pixel sizes if they are suffixed with a `p`.
125+
126+
The options `-inc_equal` can used to make the horizontal and vertical offsets
127+
the same. The options `-incx X` and `-incy Y` can be used to specify additional
128+
offsets in the respective direction. The values `X` and `Y` are percent values
129+
or pixel sizes if suffixed with a `p`. The options `flatx` and `flaty` will
130+
disable auto increments, and if used with `-incx X` and `-incy Y` can be used
131+
to specify the exact increments.
132+
133+
The following example will cascade and resize the windows to have a width
134+
of 60% the monitor, a height of 75% the monitor, and make the horizontal
135+
and vertical offsets equal.
136+
137+
{% fvwm2rc %}
138+
FvwmRearrange -cascade -inc_equal -cascadew 60
139+
{% endfvwm2rc %}
140+
141+
## Window Ordering
142+
143+
FvwmRearrange places the windows in the order they are reported by fvwm, that
144+
is the stack order (usually based off of how recently a window was focused)
145+
is used. It is possible to reorder the windows using various order options.
146+
`-order_name`, `-order_icon`, `-order_class`, and `-order_resources` orders
147+
the name, icon name, class, or resource alphabetically. `-order_xy` and
148+
`-order_yx` order the windows based on their position on the screen.
149+
`-order_hw` and `order_wh` order windows based on their height and width.
150+
All orders can be reversed using the `-reverse` option.
47151

48-
This advanced example is attached to key binding (alt-t) with functions that
49-
do the tiling with 3 columns. With the same key binding, it restores all
50-
windows. The below screenshot, before and after tiling, and the following configuration demonstrates this :
152+
## Bounding Box
51153

52-
|![image](before-after-tile.png)|
154+
FvwmRearrange honors any `EWMHBaseStruts` of the monitor it is on and will
155+
move and resize windows to fit inside the EWMH working area. If the option
156+
`-ewmhiwa` is include, the working area be ignored and FvwmRearrange will
157+
use the full monitor. The global screen can be used, `-screen g` to span
158+
multiple monitors (this implies `-ewmhiwa`).
53159

54-
Tiling with 3 columns.
160+
In addition you can specify a bounding box by adding including four additional
161+
numbers at then end of the options. The numbers give the `Left Top Right Bottom`
162+
position of the region of the monitor to use. These can either be percent values
163+
or pixel values if a `p` suffix is used.
164+
165+
The bounding box can be used to work with more complicated setups. For example
166+
if your want a web browser to take up the left half of the monitor, and then
167+
tile the remaining windows on the right half of the monitor into at most two
168+
columns, use the following (half way is 50%, if you want to avoid panels or be
169+
more exact use pixel values instead):
55170

56171
{% fvwm2rc %}
57-
DestroyFunc 3Tile
58-
AddToFunc 3Tile
59-
+ I FvwmRearrange -tile -r -mn 3 -maximize 1 3 92 92
172+
FvwmRearrange -tile -max_n 2 -fill_end 50 0 100 100
60173
{% endfvwm2rc %}
61174

62-
Tile switch on and off.
175+
## Examples
176+
177+
Setup a key binding to auto tile the current monitor, and order by class
178+
so the windows appear in approximately the same order. When windows are
179+
added or removed, just hit Alt-T to tile again.
63180

64181
{% fvwm2rc %}
65-
InfoStoreAdd TileSwitch "ON"
182+
# Alt-T auto tile
183+
Key t A M FvwmRearrange -order_class
184+
{% endfvwm2rc %}
185+
186+
Use FvwmEvent to make it so you auto tile the current monitor when a
187+
window is added or removed. This may not work the best on multi monitor
188+
setups if windows start or are closed on a monitor you aren't currently on.
189+
190+
{% fvwm2rc %}
191+
# FvwmEvent triggers on add_window and destory_window.
192+
*FE-AutoTile: Cmd Function
193+
*FE-AutoTile: add_window AutoTile
194+
*FE-AutoTile: destroy_window AutoTile
195+
196+
DestroyFunc AutoTile
197+
AddToFunc AutoTile I FvwmRearrange -order_class
198+
199+
# Run FvwmEvent when fvwm starts.
200+
AddToFunc StartFunction I Module FvwmEvent FE-AutoTile
201+
202+
# Ignore size hints so windows fill the full cell when tiled.
203+
Style * ResizeHintOverride
204+
{% endfvwm2rc %}
205+
206+
This example is attached to key binding (alt-T) which will auto tile all
207+
windows on the current monitor. With the same keybinding, it will restore
208+
all windows to their original position. To work in a multiple monitor
209+
setup, the current state is saved in an `InfoStore` variable
210+
`TitleSwitch<monitor name>`.
211+
212+
{% fvwm2rc %}
213+
DestroyFunc AutoTile
214+
AddToFunc AutoTile
215+
+ I FvwmRearrange -maximize
66216

67217
DestroyFunc Tile
68218
AddToFunc Tile
69-
+ I Test (EnvMatch infostore.TileSwitch ON) TileOn
70-
+ I TestRc (NoMatch) TileOff
219+
+ I Test (EnvMatch infostore.TileSwitch$[monitor.current] ON) TileOff
220+
+ I TestRc (NoMatch) TileOn
71221

72222
DestroyFunc TileOn
73223
AddToFunc TileOn
74-
+ I 3Tile
75-
+ I InfoStoreAdd TileSwitch OFF
224+
+ I AutoTile
225+
+ I InfoStoreAdd TileSwitch$[monitor.current] ON
76226

77227
DestroyFunc TileOff
78228
AddToFunc TileOff
79229
+ I All (CurrentPage, !Iconic, CirculateHit, !Sticky) Maximize Off
80-
+ I InfoStoreAdd TileSwitch ON
81-
{% endfvwm2rc %}
82-
83-
Key binding (alt-t)
230+
+ I InfoStoreAdd TileSwitch$[monitor.current] OFF
84231

85-
{% fvwm2rc %}
232+
# Alt-T key binding
86233
Key t A M Tile
87234
{% endfvwm2rc %}

0 commit comments

Comments
 (0)