My test grid layout monstrosity (in case anyone else is interested)



I don't know if anyone else will be interesting in this abomination of
an ugly hack, but I've been playing with it for a month or so now and I
don't think I'd be able to live without it at this point.

A while back I was inspired by this page:

http://www.codinghorror.com/blog/archives/000928.html

Particularly the numbered grid pic and the animated gif below it.

My goal was to bind hot keys to each corner and side of the screen and
make the window manager do something smart with the currently focused
window.  Hopefully I can explain fairly well, but I imagine it is more
intuitive to use than to describe.

The way I set it up so far is that my 1680x1050 screen is divided into 2
columns, at first the left column is about 1/3 of the screen and the
right column is 2/3.  If you bang on the hot key long enough they are
divided up 50/50.

The vertical space is divided up into either 2 or 3 equal rows.

For an example, the first time you hit the NorthWest (nw) key on a
window it is sized to 1/3 x 1/3 of screen dimensions and pushed to the
corner.  A second press switches that to 1/3 x 1/2, the first sizes it
to 1/2 x 1/3.

The hot key for West pushes the window to the center-left of the screen
at 1/3 x 1/3 screen size.  A second press shifts it to 1.0 x 1/3, and
the third press 1/2 x 1/3.

The other side of the screen works pretty much the same, except I
switched up the order.  I tend to divide the left half of my screen into
thirds most often, and the right half is either vertical full or halved.
 There are also hooks in there to change the fonts of my gnome terminals
depending on where the windows are.

I wasn't sure what to do with north/south/center keys, so for now they
don't do anything.  The code is ugly, but it works.  It is some sawfish
lisp that calls a Perl script with window position, dimensions, class,
and id.  The Perl script then uses sawfish-client to actually resize the
window.  I started to try to write the whole thing in lisp, but I
haven't the foggiest idea how to properly set up an access any kind of
complex data structure.

It also, unfortunately, has completely hard coded window placement/size
numbers (for 1680x1050, with a gnome-panel, and assuming the Toyberg
theme).  When I started, I didn't know I would be dividing up the screen
so evenly.

It does the job, though, and I think it is a good proof of concept.  I'd
love some input on the idea.  I was going to put it up on the wiki, but
the scripts section didn't seem like it was going to appreciate me
uploading a .pl file, so I tarred it up and threw it on my web server:

http://patshead.com/sawfish/pjr-grid-0.1.tar.gz

Any input at all is appreciated (even if only to poke fun at my lack of
lisp abilities).  :)

Pat

Attachment: signature.asc
Description: OpenPGP digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]