Go to the first, previous, next, last section, table of contents.

moveresize Extension Module

This module provides functionality for moving and resizing windows. The core functionality is implemented by the abstract base class MoveResize. It is subclassed by the two classes MoveResizeOpaque and MoveResizeOutline which resizes windows by changing the window size, and by drawing an outline of the new size, respectivelly. The latter requires the outline module. See the code for details on these classes.

Most resizing will be done via key handlers, so a template key handler class is provides that simplifies writing your own moving and resizing keyhandler for the currently focused client:

Class: MoveResizeKeys ( from_keyhandler, event )

MoveResizeKeys contains methods for the various move and resize operations. Is should be subclassed, and in the subclass key binding method names should be assigned to the general methods.

There are 24 general methods:
_move_X Move the client in direction X
_enlarge_X Enlarge the client in direction X
_shrink_X Shrink the client from direction X

The direction is one of eight combinations of the four cardinal points: e, ne, n, nw, w, sw, s and se.

Additionally theres two methods for finishing the moveresize:
_moveresize_end Finish, actually moving and resizing the client
_moveresize_abort Abort, leaving client with its old geometry

By default outline moveresizing is used with the MoveResizeOutline class. This can be changed by redefining the attribute _moveresize_class to any subclass of MoveResize.

A small MoveResizeKeys subclass example:

class MyMRKeys(MoveResizeKeys):
    _moveresize_class = MoveResizeOpaque
    KP_Left = MoveResizeKeys._move_w
    KP_Right = MoveResizeKeys._move_e
    KP_Up = MoveResizeKeys._move_n
    KP_Down = MoveResizeKeys._move_s
    KP_Begin = MoveResizeKeys._moveresize_end
    Escape = MoveResizeKeys._moveresize_abort

This would be invoked like this in a keyhandler event method in your basic keyhandler:

def KP_Begin(self, evt):
    MyMRKeys(self, evt)

MoveResize generates events during operation. The type attribute for all these are the event class, and the client attribute is the affected client.

MoveResizeStart is generated when the moveresize is started, MoveResizeEnd when it ends and the window geometry is changed, and MoveResizeEnd when it is aborted and the window geometry is left unchanged.

MoveResizeDo is generated for each change in window geometry during moveresize. It has four attributes denoting the current geometry: x, y, width and height.

Go to the first, previous, next, last section, table of contents.