Copyright | (c) Norbert Zeh <norbert.zeh@gmail.com> |
---|---|
License | BSD3 |
Maintainer | Norbert Zeh <norbert.zeh@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Three layouts: The first, Spiral
, is a reimplementation of
spiral
with, at least to me, more intuitive semantics.
The second, Dwindle
, is inspired by a similar layout in awesome and
produces the same sequence of decreasing window sizes as Spiral but pushes
the smallest windows into a screen corner rather than the centre. The third,
Squeeze
arranges all windows in one row or in one column, with
geometrically decreasing sizes.
Usage
This module can be used as follows:
import XMonad.Layout.Dwindle
Then add something like this to your layouts:
Dwindle R CW 1.5 1.1
or
Spiral L CW 1.5 1.1
or
^ Squeeze D 1.5 1.1
The first produces a layout that places the second window to the right of the first, the third below the second, the fourth to the right of the third, and so on. The first window is 1.5 times as wide as the second one, the second is 1.5 times as tall as the third one, and so on. Thus, the further down the window stack a window is, the smaller it is and the more it is pushed into the bottom-right corner.
The second produces a layout with the same window sizes but places the second window to the left of the first one, the third above the second one, the fourth to the right of the third one, and so on.
The third produces a layout that stacks windows vertically top-down with each window being 1.5 times as tall as the next.
In all three cases, the fourth (third, in the case of Squeeze
) parameter,
1.1, is the factor by which the third parameter increases or decreases in
response to Expand or Shrink messages.
For more detailed instructions on editing the layoutHook see:
Layouts with geometrically decreasing window sizes. Spiral
and Dwindle
split the screen into a rectangle for the first window and a rectangle for
the remaining windows, which is split recursively to lay out these windows.
Both layouts alternate between horizontal and vertical splits.
In each recursive step, the split Direction2D
determines the placement of the
remaining windows relative to the current window: to the left, to the right,
above or below. The split direction of the first split is determined by the
first layout parameter. The split direction of the second step is rotated 90
degrees relative to the first split direction according to the second layout
parameter of type Chirality
. So, if the first split is R
and the second
layout parameter is CW
, then the second split is D
.
For the Spiral
layout, the same Chirality
is used for computing the split
direction of each step from the split direction of the previous step. For
example, parameters R
and CW
produces the direction sequence R
, D
,
L
, U
, R
, D
, L
, U
, ...
For the Dwindle
layout, the Chirality
alternates between CW
and CCW
in
each step. For example, parameters U
and CCW
produce the direction
sequence U
, L
, U
, L
, ... because L
is the CCW
rotation of U
and
U
is the CW
rotation of L
.
In each split, the current rectangle is split so that the ratio between the
size of the rectangle allocated to the current window and the size of the
rectangle allocated to the remaining windows is the third layout parameter.
This ratio can be altered using Expand
and Shrink
messages. The former
multiplies the ratio by the fourth layout parameter. The latter divides the
ratio by this parameter.
Squeeze
does not alternate between horizontal and vertical splits and
simply splits in the direction given as its first argument.
Parameters for both Dwindle
and Spiral
:
- First split direction
- First split chirality
- Size ratio between rectangle allocated to current window and rectangle allocated to remaining windows
- Factor by which the size ratio is changed in response to
Expand
orShrink
messages
The parameters for Squeeze
are the same, except that there is no Chirality
parameter.
Dwindle !Direction2D !Chirality !Rational !Rational | |
Spiral !Direction2D !Chirality !Rational !Rational | |
Squeeze !Direction2D !Rational !Rational |
Instances
LayoutClass Dwindle a Source # | |
Defined in XMonad.Layout.Dwindle runLayout :: Workspace WorkspaceId (Dwindle a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (Dwindle a)) # doLayout :: Dwindle a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Dwindle a)) # pureLayout :: Dwindle a -> Rectangle -> Stack a -> [(a, Rectangle)] # emptyLayout :: Dwindle a -> Rectangle -> X ([(a, Rectangle)], Maybe (Dwindle a)) # handleMessage :: Dwindle a -> SomeMessage -> X (Maybe (Dwindle a)) # pureMessage :: Dwindle a -> SomeMessage -> Maybe (Dwindle a) # description :: Dwindle a -> String # | |
Read (Dwindle a) Source # | |
Show (Dwindle a) Source # | |
data Direction2D Source #
Two-dimensional directions: