Macro: Auto Split Screen App with 2 windows or most recent app

Since this community has helped me so many times and helped me learn the KM app I wanted to share a macro I have been using over the last 2 months and have found very valuable.

Sorry if this is a duplicate but I didn’t see anything exactly like it so I thought I would share.

I find myself a lot of QA testing and switching back and forth between browsers. Most of the time I’ll want the browsers to be side by side at 50% each.

For the longest time I had been activating both apps and using keyboard shortcuts to move the windows around. Simple process but I thought what is current 4 actions could be made into 1.

So what this Macro does is

IF: Check and see if the currently activated has more than 1 window (Use calculation WINDOWCOUNT()=2. If it has a 2nd window I would want both of those windows to be side by side, so it splits the.

If The currently activated app does not have a 2nd window open this app but the front app window to half the screen on the left side and then activates the last application and move that window to be ½ on the right side of the screen.

My real-world application for this is, I may be comparing a page on say Chrome and I want to look at its side by side on safari.

I even borrowed I’ve seen some of the experts use on here as a cool little feature of moving the mouse to the toolbar of the top front window and circle the mouse location.

Feel free to use the Macro or if you have an idea for how this maybe could be made better, I’m all ears!

Split 2 Windows.kmmacros (14.4 KB)

This macro is made for demo purposes.


I am using a app called "Deskovery". This app can do window management as what you say. And "Hammerspoon" can also do that.
What is irreplaceable is that Deskovery can make a window always-on-the-top and it can change the window to subtransparent, which i thought is better than window management.

I will find time to try to inplement togging always-on-the-top and changing transparency for window, by Keyboard Maestro.


Thanks for sharing.

The usual protocol here is to post both the macro file and macro image, so readers can see your macro before they download it. Many users will not download a Macro they have not seen.

You can use this procedure to upload both at once: upload your macro .

AH knew I'd forget a step. Just edited the post

Really excited at Deskovery's ability to make anything always-on-top and change transparency, but looks like they haven't updated that in awhile, and beta invite goes to page-not-found :frowning: