Home Projects Teaching Publications Software

Software

WinZap


Illustration of the layout for four
windows for the "grid" layout


Illustration of the layout for three
windows for the "focus" layout

Download: winzap.py

This is a little python script that aims to bridge the gap between tiling window managers, which are great for optimising the use of a screen's real estate, and stacking window managers, which allow for more flexibility and work more nicely with some programs. The script simply re-arranges the windows on the current display in a chosen pattern, where the patterns are currently:

grid
Arranges the windows on a regular grid. The scripts takes the width and the height of the display into account, as well as the number of windows, so as to find a grid setup that minimizes wasted space and makes the shape of the windows as convenient as possible.
focus
The window that has the current focus is placed to the left, over the whole height of the screen. The other windows on the current display are arranged to the right, one above the other, in a regular grid. Moving a different window to the focus area simply requires moving the focus to the desired window and calling the script again.
focus2
Identical to "focus", but the focused window takes two thirds of the screen width, instead of half. This is especially useful for larger, wide displays.

Usage

It is convenient to bind key-combinations to calling the script. I personally use the XFCE window manager, and have bound the following keys to the script as

alt-escwinzap.py focus
alt-shift-escwinzap.py focus2
super-escwinzap.py grid

The winzap.py script is inspired heavily from stiler.py, another python script that offers similar functionality, but has the following advantages over the original:

  1. winzap.py is aware of xinerama desktops consisting of multiple screens, and allows for the windows in each screen to be arranged separately.
  2. it deals nicely with desktop panes, hidden windows, minimized windows, maximized windows, taskbars, etc.
  3. I guess it is a bit easier to extend