FVWM: Window Packing

From: Tavis Ormandy <taviso_at_sdf.lonestar.org>
Date: Wed, 6 Aug 2003 18:07:37 +0000

Hey guys, im trying to convince a friend of mine to switch to fvwm from
sawfish, one of the features he said fvwm would have to have before
switching is "Window Packing".

This is how window packing was explained to me: directing a window to
move in a given direction (Up, Down, Left, Right) until it hits
something; eg a screen edge or another window.

It took me a few hours to work out how to do this, but I think i've
finally got a working function, and imho, it's pretty slick :-) (the
effect that is, my implementation is not very elegant :-) )

I thought id share it, so here goes:

DestroyFunc PackWindowUp
AddToFunc PackWindowUp
+ I SetEnv low_w 0
+ I All (CurrentPage !Iconic AcceptsFocus \
        !Shaded ) PipeRead "test `expr $[w.y] + $[w.height]` -gt $$low_w \
        -a `expr $[w.y] + $[w.height]` -lt $0 \
        -a \\( \\( $[w.x] -gt $1 -a $[w.x] -lt `expr $1 + $2` \\) \
            -o \\( $1 -gt $[w.x] -a $1 -lt `expr $[w.x] + $[w.width]` \\) \
            -o \\( $1 -lt $[w.x] -a `expr $1 + $2` -gt `expr $[w.x] + $[w.width]` \\) \
            -o \\( $[w.x] -lt $1 -a `expr $[w.x] + $[w.width]` -gt `expr $1 + $2` \\) \
        \\) \
        && echo SetEnv low_w `expr $[w.y] + $[w.height]` \
        || echo Nop"
+ I WindowId $3 AnimatedMove keep $[low_w]p

DestroyFunc PackWindowDown
AddToFunc PackWindowDown
+ I SetEnv high_w $[vp.height]
+ I All (CurrentPage !Iconic AcceptsFocus \
        !Shaded) PipeRead "test $[w.y] -lt $$high_w \
        -a $[w.y] -gt `expr $0 + $4` \
        -a \\( \\( $[w.x] -gt $1 -a $[w.x] -lt `expr $1 + $2` \\) \
            -o \\( $1 -gt $[w.x] -a $1 -lt `expr $[w.x] + $[w.width]` \\) \
            -o \\( $1 -lt $[w.x] -a `expr $1 + $2` -gt `expr $[w.x] + $[w.width]` \\) \
            -o \\( $[w.x] -lt $1 -a `expr $[w.x] + $[w.width]` -gt `expr $1 + $2` \\) \
        \\) \
        && echo SetEnv high_w $[w.y] \
        || echo Nop"
+ I PipeRead "echo WindowId $3 AnimatedMove keep `expr $[high_w] - $4`p"

DestroyFunc PackWrapperUp
AddToFunc PackWrapperUp
+ I NoWindow PackWindowUp $[w.y] $[w.x] $[w.width] $[w.id]

DestroyFunc PackWrapperDown
AddToFunc PackWrapperDown
+ I NoWindow PackWindowDown $[w.y] $[w.x] $[w.width] $[w.id] $[w.height]

Key Down WTF SM PackWrapperDown
Key Up WTF SM PackWrapperUp

I've only written PackWindowUp/Down here, but its easy to extend it. And it
only includes windows with that accept focus and are not shaded, edit to
preference.

If anyone has any ideas for a more elegant solution, id love to hear it :-)

-- 
-------------------------------------
taviso_at_sdf.lonestar.org | finger me for my gpg key.
-------------------------------------------------------
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Wed Aug 06 2003 - 13:09:23 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:55 BST