Next: , Previous: Window Stacking, Up: Windows


8.7 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 associated with object window so that it has certain X and Y dimensions. 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.

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.

— Command: move-window-interactively window

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

— 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: move-selected-window

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

— Command: resize-selected-window

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

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.

— Variable: move-snap-edges

When non-nil, the window position is “snapped” to edges of other windows within close proximity.

— Variable: move-snap-epsilon

The distance in pixels before snapping together two edges.

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).