ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE. Software > JGPaiva's GridMove and Ahk Tools

Tips/primer for new or lazy grid writers. Bonus:unanswered technical questions.


Hi Folks,

I thought I'd share some thoughts and tips on coding your first .grid.

There is an excellent topic by Tyinsar which covers coding grids in depth. I highly recommend this topic.
That being said, as a coder, I rarely read documentation from end to end and only reference when needed.

The quickest way to get a grid working is to find a grid similar to what you want. You are thinking I'll start simple with a simple two window grid (2 Part-Vertical.grid) and add what I want. You open the file to find it has 9 groups! Groups mean target areas. There are 9 in this config because it accounts for 3 monitors. Each monitor only has 3 groups. Figure out which monitor you want to work on and note the gridmove monitor number.

Each group has a trigger area. You gotta move your window to this area to trigger this. If nothing else is defined, your window is placed/resized as the size of the trigger area.

The cool and fun part is that you can have a target placement different from the trigger area. Some people have taken this to make a whole bunch of small triggers which translate to different windows. One example of this is Good Griddance.grid

When you start to edit your triggers, be sure to turn on the right click options "show grid" + "show numbers on grid". The numbers displayed correspond to the groups defined in the .grid file.

I like my triggers to be in this format :
  TriggerTop    =
  TriggerLeft   =
  TriggerRight  =
  TriggerBottom =
because it makes the most sense to me .... they can be in any order though.

When/if you include the target area you will use the following in the SAME GROUP.
  GridTop       =
  GridLeft      =
  GridRight     =
  GridBottom    =

And these are just the target coordinates of where put the window if you activate the trigger of this group.

You can add target coordinates as absolute numbers. But there are a bunch of ready to use constants:
They are pretty self explanatory. Just replace the number for the monitor you are working on.

There is another set of constants that ignore the windows taskbar:
You can use these if for some reason you need to cover up the taskbar with a target window.

There are some special target coordinates like maximize and restore (undo) which maxes the window(duh) or puts it back to where you dragged it from. There are others..check tyinsar or read the help.

I tried Gridstack by Xitsa to generate grids. It seems pretty powerful but I ended up just hand coding my grids in the end.


-Always make sure to change the number of groups in the header to match your actual number of groups. You think this is funny, but you'll forget to do this and wonder why it isn't working when you hand edit your grids.

-Use refresh and restart as needed to bring up new configs

-when gridmove is activated,  orange lines are trigger areas; grey blocks are where the window will end up.

-use versioning for your changes. that way you can revert when you have no idea where you went wrong.

-remember the top left corner is 0,0!  Make sure to use the correct operation (addition or subtraction) according to the reference constant you are using. For example, in my config, trigger bars are made with +50px if the are on the top or the left. From the bottom or the right they are -50px. This is because of the reference constants used.

-Hotkey :  win+g then             
                   m to maximize toggle
                   0 (zero) to minimize 
                   r to reload template
                  # to activate # trigger if "use command"+"fastmove" are turned on
                  esc to cancel hotkey mode

Unanswered technical questions:

1)How are the monitors numbered? My 2 output setup is inversed from the windows designation and the .grid file. (i.e gridmove monitor 1 is designated as monitor 2 by windows)

2)What happens when 2 trigger areas overlap? For example, if I define a big trigger area and then a smaller trigger inside it, will it work? What if I define a small trigger area and then cover it with a larger trigger? What's the rule? I think first declared supersede last declared but I've had some complex configs break because I don't know for sure.
*Answered* I did some more experiments and it does seem first declared supercedes later declared. i.e lower group numbers override higher numbers. This has some implications for the order of defined triggers and does explain why some of the grids with huge numbers of triggers go outside-in such as 100possibilities.grid.
*This also means I can remove some of the extra trigger calculations that I added to prevent overlapping in my current config to make it simpler. Though I'll leave some of them in because I like the current window numbering.

3)What is the best way to capture the grid config visually?  There has to be a good standard way to show grids to others via jpg/png. I just don't know it.


Just wanted to say thanks for posting this  :up:


[0] Message Index

Go to full version