]> git.draconx.ca Git - fvwmconf.git/blob - resize.sh
Add support for multiple screens.
[fvwmconf.git] / resize.sh
1 #!/bin/sh
2 # resize.sh mouseX mouseY windowW windowH
3 # Emits an FVWM directed resize command based on the position of the mouse
4 # cursor within a window (mouseX, mouseY) and the width and height of the
5 # window (windowW, windowH).
6
7 if [ $# -lt 4 ]; then
8         echo "usage: $0 mouseX mouseY windowW windowH"
9         exit 1
10 fi
11
12 echo -n "Resize Direction "
13
14 # Straight directions
15 if [ $1 -le $(($3/4)) -a $2 -ge $(($4/3)) -a $2 -le $(($4/3*2)) ]; then
16         echo "West"
17 elif [ $1 -ge $(($3/4*3)) -a $2 -ge $(($4/3)) -a $2 -le $(($4/3*2)) ]; then
18         echo "East"
19 elif [ $2 -le $(($4/4)) -a $1 -ge $(($3/3)) -a $1 -le $(($3/3*2)) ]; then
20         echo "North"
21 elif [ $2 -ge $(($4/4*3)) -a $1 -ge $(($3/3)) -a $1 -le $(($3/3*2)) ]; then
22         echo "South"
23 # Quadrants
24 elif [ $1 -le $(($3/2)) ]; then
25         if [ $2 -le $(($4/2)) ]; then
26                 echo "NorthWest"
27         else
28                 echo "SouthWest"
29         fi
30 else
31         if [ $2 -le $(($4/2)) ]; then
32                 echo "NorthEast"
33         else
34                 echo "SouthEast"
35         fi
36 fi