cycle Extension Module
cycle provides classes for cycling among windows to select one of
them to be activated. This is performed by an abstract base class:
Cycle among the windows on screen matching client_filter.
Cycle to the next window.
Cycle to the previous window.
Finish and activating the selected window.
Abort, not activating the selected window.
This is implemented by two subclasses: CycleActive which cycles
among windows by activating them in turn, and CycleOutline which
cycle among windows by drawing an outline of the currently selected
window. The latter requires the outline extension.
To simplify writing a key handler for cycling, a template key handler is provided:
Cycle among the windows on the current screen matching the client filter
specified by the attribute _cycle_filter. This is
cfilter.true by default, cycling among all windows. The cycle
method is specified by the attribute _cycle_class, which by
default is CycleOutline.
CycleKeys defines a number of event handler methods:
| _cycle_next | Cycle to the next client |
| _cycle_previous | Cycle to the previous client |
| _cycle_end | Finish, selecting the current client |
| _cycle_abort | Abort, reverting to the previous state (if possible) |
A small CycleKeys subclass example:
class MyCycleKeys(CycleKeys):
_cycle_class = CycleActivate
_cycle_filter = cfilter.Not(cfilter.iconified)
Tab = CycleKeys._cycle_next
C_Tab = CycleKeys._cycle_next
S_Tab = CycleKeys._cycle_previous
S_C_Tab = CycleKeys._cycle_previous
Return = CycleKeys._cycle_end
Escape = CycleKeys._cycle_abort
To activate your cycle keys, write a keyhandler event method like this in your basic keyhandler:
def C_Tab(self, evt):
MyCycleKeys(self, evt)
Go to the first, previous, next, last section, table of contents.