# HOWTO: Low Overhead Grid/Winsplit functionality on Gnome with quicktile.py



## carlton_draught (Nov 22, 2010)

If you've ever used Winsplit or Grid in Compiz, you will know why you want to do this. 

If you haven't, Grid (a clone of Winsplit in Windows) allows you to use <Ctrl><Alt> and a keypad number to move the active window to the left, right, upper right, lower right, lower left, upper left etc. I use 4 monitors in a portrait configuration using twinview and xinerama (I think?). Using this enables me to quickly snap a window to a whole monitor, or half of a monitor, within a given two monitors. With that amount of screen real estate, this is all the granularity I want or need. (Note that x11 using 4 monitors is not perfect - you have a gnome panel on each set of two, and you can spawn applications into one of those two sets, which you can then orient as you wish. Some things you can only have on one set, e.g. openoffice. So far I have just restricted myself to using openoffice on the one set of monitors.)

Unfortunately, Compiz is necessary to get Grid. While the eye candy is nice, I have found Compiz to be finicky to set up and less than reliable. It would be really nice to have Grid without Compiz. So I found a python script called quicktile.py by Stephan Sokolow. I modified it slightly, now it is working perfectly as I want it, and now I have gnome without the compiz overhead. Great!

Here is how to do it:

Download quicktile.py (I used ver .1.4). Extract using a gnome right click on the file, and "Extract here".
You will need to install two ports: lang/python and x11-toolkits/py-xlib.
Test it out by typing:
`# python /path/to/quicktile.py -d`
Now do some <Ctrl><Alt>4 or <Ctrl><Alt>6.
You might find that you really have no use for most of the states it cycles through. I certainly didn't. Here is how to stop that behavior (warning: ugly hack follows):
Open up the quicktile.py with your favorite editor. Note that you can soon find some code that looks like this:

```
POSITIONS = { 
       'left'           : ( 
           (0,         0,   0.5,       1), 
           (0,         0,   1.0/3,     1), 
           (0,         0,   1.0/3 * 2, 1) 
       ),
```
Just stick a "#" in front of a tuple, execute the script as before and note which state does not get cycled through. That will be the state we want to have the script only be able to iterate through. So in my case, only the first option was useful to me and so I made that bit of code look like so:

```
POSITIONS = { 
       'left'           : ( 
           (0,         0,   0.5,       1), 
           (0,         0,   0.5,       1),
           (0,         0,   0.5,       1)
       ),
```
Problem solved! Now do this to each of the remaining POSITIONs, and you are ready to proceed to the next step. After you have a look at which the first one was, you can have a good guess as to the correct values of the remaining right, top-left, top-right etc.
Go to Prefences->Startup Applications->Add.
In the command window, make sure that it reads:

```
python /path/to/quicktile.py -d
```

Name and comment as you wish, e.g. Quicktile
Because for some reason the startup stuff only applies to one set of monitors (Screen?), you will need to add a shortcut to the panel there so that you can execute it on startup, and have quicktiling goodness everywhere. Right click on the gnome panel -> "Add to Panel"->Custom Application Launcher.
In the command window, make sure that it reads:

```
python /path/to/quicktile.py -d
```

Name and comment as you wish, e.g. Quicktile, and Ok.
(If anyone knows how to obviate the step of adding a button to the panel, I am all ears.)


----------



## ssokolow (Sep 13, 2011)

I haven't used GNOME in a while, so I don't know whether they've changed it, but last time I used it, the way to get things running automatically on GNOME was to use *System > Preferences > Sessions*.

By the way, sorry about having to edit the quicktile code to adjust the layouts. I'm still trying to decide on the cleanest way to do a list of lists like that in a human-readable config file without depending on the json module. (Which only made it into the Python standard library in 2.6)

I have just started to add support for rebinding keys via config file though.


----------

