Clear all

Keyboard Maestro - Move active window to primary display  



Okay, so in the latest MGG (#714), listener Dan had a tip about using Keyboard Maestro to move the active window that just opened on a secondary display to the primary display. What action do you use in KM to do that? I've found the "Move a Window" action, but it only appears to be able to move to a pixel location.

What I've been using is Moom, which comes up at a keyboard combo and then using Option-Arrow moves the window to the display in that "direction" based on how the displays are arranged in the Display pref pane.

This works for me, but with KM I think I could automate the process so that any new window that opens on my secondary screen moves immediately to the primary.

I do screencasts for ScreenCasts Online and it's such a pain when a window opens on the wrong screen. Having a Keyboard Maestro command to pop it in would be awesome.

I've asked listener Dan to chime in here!

3 Answers

Both macros are really simple. In the cursor centering macro, I just set a variable I call cursorLocation to 1000,500 in the first step. In the second step is "Set the Mouse Location" and   that is told to use the variable cursorLocation.

The other macro is only 1 step. The step is "Center Front Window at Position." Choose center at and then enter a position that makes sense for you and your display. I use 1000 and 500 for this too. The only tricky thing about using it is that once you realize you don't see the window, you need to avoid the urge to click around looking for it and trigger the macro instead. Once you click on some other window, the missing window is not the "Front Window" anymore.

Hope that helps.

Thanks, @dan!

Hi Dan,

I was able to combine it into a single two-action macro:


Screen Shot 2018 06 27 at 1.49.55 PM

You could also use an IF actions to determine if you have your second monitor connected, and execute the macro to move the window specifying if you want to move it on the MAIN display or the SECOND display. I'm just giving you pieces of the puzzle without giving you the entire solution here, but what fun would that be for us geeks;-)


Capto Capture 2018 06 27 04 14 30 PM

well, no images and you can't attach two screengrabs, no ideal. Here's the second screengrab...

Capto Capture 2018 06 27 04 13 43 PM