Next: , Previous: , Up: Windows   [Contents][Index]


8.10 Moving and Resizing Windows

As noted above (see Window Attributes), the window-dimensions and window-position functions return the current configuration of a window.

Function: move-window-to window x y

Move the top-left corner of the window frame of window to (x, y).

Function: resize-window-to window width height

Set the dimensions of the client window associated with object window to (width, height).

Function: move-resize-window-to window x y width height

Move the top-left corner of the window frame of window to (x, y), and set the dimensions of the frame to (width, height).

Function: resize-window-with-hints window cols rows #!optional hints
Function: resize-window-with-hints* window width height #!optional hints

Resize the window window respecting the hints (see below). For the first function, the dimensions are cols columns and rows rows. For the second function, the dimensions are width pixels and height pixels.

The hints parameters is either the size hints alist to use, or nil in which case the window-size-hints function is used to retrieve the window’s hints.

Hints can specify minimum or maximum value of each dimension, and also increase step, as far as these two functions are concerned.

Function: window-size-hints window

Return an alist defining the size-hints structure specified by the client window associated with window. Possible keys in the alist are min-height, max-height, min-width, max-width, height-inc, width-inc, min-aspect, max-aspect, base-height, base-width, user-position, program-position, user-size, program-size, window-gravity, border-size.

Usually, however, it is left to the user to configure windows. The following functions may be called interactively: their sole argument is then either the window that received the current event or the currently focused window.

Sawfish honors the min-aspect and max-aspect window hints when interactively resizing a window.

Function: move-window-interactively window
Command: move-window-interactively window

Move window interactively using the mouse. Releasing any mouse button places the window at its current position.

Function: resize-window-interactively window
Command: resize-window-interactively window

Resize window interactively using the mouse. Releasing any mouse button places the window at its current position.

Note that this function selects the edge or edges of the window to move from the current position of the mouse when the resizing begins. The window is divided into a three-by-three grid; the rectangle containing the mouse pointer gives the direction to resize in. If the pointer is in the central rectangle the bottom and right edges are moved.

Command: resize-window-to-preset-size
Command: resize-window-to-preset-height
Command: resize-window-to-preset-width

For these commands, first you specify a window dimension(s) in the configurator. The focused window will be resized to that preset size on invocation.

Command: resize-window-prompt window

You’re prompted to enter the new window size, and the window will be resized.

Function: move-selected-window
Command: move-selected-window

Wait for the user to select a window using the mouse, then interactively move that window.

Function: resize-selected-window
Command: resize-selected-window

Wait for the user to select a window with the mouse, then interactively resize that window.

Command: double-window-size window
Command: halve-window-size window

Double / halve the size of window in both direction, i.e. the area will be 4 or 1/4 times.

Sawfish supports increasing the windows size until it touches another window. This is called “grow”. “Shrink” achieves the opposite, i.e. it decreases the windows size, until it does no longer overlap any other window. More precisely, the grow can be done repeatedly, each time until the edge meets another edge, and shrink is done so that it overlaps with one less window.

Function: grow-window-up window #!optional arg
Function: grow-window-down window #!optional arg
Function: grow-window-left window #!optional arg
Function: grow-window-right window #!optional arg

Grows window upwards / downwards / left / right until it touches another window. If that edge is beyond the screen edge, it is brought back in. With a universal prefix arg, maximize in that direction instead. With a numeric prefix arg, grow by that many increments specified by window or pixels instead.

There are commands, too, with the same name.

Function: shrink-window-up window
Function: shrink-window-down window
Function: shrink-window-left window
Function: shrink-window-right window

Shrinks window by moving one edge upwards / downwards / left / right until it intersects with one window less than before. (So, in shrink-window-up for example, the lower edge is moved.)

Window won’t be made smaller than the minimum size, or shrink-window-minimum-size. More precisely, size truncation may make the window smaller than these values.

There are commands, too, with the same name.

Moving counterparts, instead of resizing of “grow” and “shrink”, are “pack” and “yank”. So, “pack” moves until the window touches another, and “yank” moves until the overlap reduces.

Function: pack-window-up window #!optional arg
Function: pack-window-down #!optional arg
Function: pack-window-left window #!optional arg
Function: pack-window-right window #!optional arg

Moves window upwards / downwards / left /right until it touches another window. If that edge is beyond the screen edge, it is moved back in. With a universal prefix arg, move in that direction maximally instead. With a numeric prefix arg, move by that many pixels instead.

There are commands, too, with the same name.

Function: yank-window-up window
Function: yank-window-down window
Function: yank-window-left window
Function: yank-window-right window

Yanks window upwards / downwards / left / right until it overlaps with one less window than before.

There are commands, too, with the same name.

Grow, pack, shrink and yank behavior can be customized through the following variables:

Variable: grow-is-maximize

Whether growing is considered to be maximization. The default value is t.

Variable: pack-warp-pointer

Whether and how to move the pointer, either always maybe or never. The default value is maybe

maybe means that the pointer is moved along with the window, if the pointer was within the window area before packing. always warps the pointer to the center of the window if it isn’t already in the window, then does like maybe. never means not to warp the pointer.

Variable: grow-pack-bump-obscured

Whether to bump into fully obscured windows. The default value is nil.

Variable: grow-pack-bump-other-depth

Whether to bump into windows on a different depth, either always maybe or never. The default value is always.

maybe means only avoided windows (see Avoided Windows).

Variable: grow-pack-bump-ignored

Whether to bump into ignored windows. The default value is t.

Variable: shrink-window-minimum-size

The minimum height or width to which a window may be shrunk. The default value is 10.

Variable: yank-window-minimum-visible

The minimum amount of window left visible, if yanked over the screen edge. The default value is 10.

Function: move-window-center window
Command: move-window-center window

Place window in the middle of the screen (frame-size is respected while calculating position)

The interactive move and resize behavior can be customized through the following variables:

Variable: move-outline-mode

A symbol defining the visual method of interactively moving windows. Current options include box for a wire-frame grid, and opaque for full redisplay.

Variable: resize-outline-mode

A symbol defining the visual method of interactively resizing windows. Current options include box for a wire-frame grid, and opaque for full redisplay.

Variable: move-show-position

When non-nil, the current window position is shown in the center of the screen.

Variable: resize-show-position

When non-nil, the window size is shown in the center of the screen.

When you move a window and it comes close to another, sawfish adjusts its position so that its edge fits to the other, or “snaps”. (It may be dubbed as “interactive tiling”.) Snapping also takes place agaisnt screen boundary.

Variable: move-snap-epsilon

The distance in pixels before snapping together two edges. The bigger the value, the more adhesive windows get.

Windows have a “gravity” property, which affect how they are placed in particular positions.

Function: window-gravity window #!optional hints

Returns the gravity of window. The order of precedence is Sawfish gravity window property, explicit hints argument, X window size hints. The default gravity when nothing else is specified is north-west (specified by ICCCM).


Next: , Previous: , Up: Windows   [Contents][Index]