Window control over dual monitors

I've used Keyboard Maestro on a 27" iMac for a few years, primarily as a means of controlling window size and position.

Having just got a new iMac 5K I'm experimenting with using my old iMac as a second monitor (5K is on right, older one on left). Here's a quick visual shorthand of the dual monitor setup, with the numbers designating half of the screen:

[ 1 | 2 ] [ 3 | 4 ]

I've tried Window Movers on the Keyboard Maestro wiki, but it's not working properly. The way I read the documentation if a window fills the left most part of the left most monitor (represented by 1) then invoking Window Right repeatedly should see move the window move as follows:

1 2 3 4 1 2 3 4 1 …

But when I use the macro the window moves like this:

1 2 3 2 3 2 3 2 …

And if try using Window Left then it exhibits similar behaviour. Best case scenario is:

2 1 4 1 4 1 4 1 …

Has anyone got ideas for a fix, or just troubleshooting the problem?

Alternatively any suggestions of how I can modify my existing macros which were setup for a single monitor, which have served me so well to date?

Here are the seven macros I use, and an example of how Window Left is setup:

Screens are numbered from left to right, so with two screens, the left screen is 1, and right screen is 2.

Basically, you write a macro that bases its action on how far left the middle of the window is, something like this:

  • If Calculation WINDOW(1,MidX) < SCREEN(1,MidX)
    • Position window on left side of screen 1
    • Cancel This Macro
  • If Calculation WINDOW(1,MidX) < SCREEN(1,Right)
    • Position window on right side of screen 1
    • Cancel This Macro
  • If Calculation WINDOW(1,MidX) < SCREEN(2,MidX)
    • Position window on left side of screen 2
    • Cancel This Macro
  • Position window on right side of screen 2

Thanks for this Peter. I’m having a few problems making this work, but I’ll go away and experiment and see if I can’t get a better grasp of why it’s not working.