Perl Window Manager
Sorry, this documentation is pretty out of date - and applies to perlwm 0.0.1.
There are currently a handful of configuration variables that you can change (althought they are not yet in a seperate configuration file). They control things like fonts, colors, and the combinations in which they are used, as well as actions and bindings.
%font - this defines the fonts that will be used. It maps a name to a font definition.
%font = (title => 'lucidasans-14',
title_focus => 'lucidasans-bold-14');
%color - this defines the colors that will be used. It maps a name to a color definition.
%color = (frame => 'grey75',
frame_focus => 'white',
title => 'black',
title_focus => 'red');
%gc - this defines the GCs (graphics contexts) that will be used to draw various elements. It maps names to GC attributes - fonts and colors used must be in defined in %font or %color. GCs are cached (as are fonts and colors). (Currently, the value of this variable looks a bit redundant, but in future it should become more useful.)
%gc = (frame => { foreground => 'frame' },
frame_focus => { foreground => 'frame_focus' },
title => { foreground => 'title', font => 'title' },
title_focus => { foreground => 'title_focus', font => 'title_focus' } );
%dim - this defines various dimensions.
%dim = (frame_width => 2);
%actions - this defines 'actions' (perhaps 'functions' might be a better term). They define what piece of code gets executed for a particular event (press, drag and release).
%actions = (move => { drag => \&move_drag },
size => { press => \&size_press, drag => \&size_drag } );
%bindings - this defines how buttons (and in the future keys) are bound to actions in various contexts.
%bindings = (frame => { 'Button1' => 'move' },
window => { 'Mod1 Button1' => 'move',
'Control Mod1 Button1' => 'size',
'Button1' => '+click' } );
Sample action code. Here is the code needed to define the 'move' action. It will be called during a drag (after
an appropriate binding has been triggered). The three parameters are $c
(client - describes the window),
$s
(state - describes the current action state) and $e
(event - the most recent X event). What
this function does is move the current window my
the incremental amount the mouse moved since the
last event. This configuration gives us what is usually called 'opaque move' - the whole window will move with the
mouse. Other behaviour can be easily achieved by handling just the press and release, or handling the drag differently.
sub move_drag {
my($c, $s, $e) = @_;
$c->{x} += $s->{drag}->{inc_x};
$c->{y} += $s->{drag}->{inc_y};
$x->ConfigureWindow($c->{frame}, x => $c->{x}, y => $c->{y});
}
http://perlwm.sourceforge.net/ adapted copy