Window Management with Keyboard Maestro

Window management made easy: I’ll show you how to set up macros in Keyboard Maestro to quickly position your front window to the left, right, or center of either your first or second screen, keeping your workspace organized. You can download the macros below and adjust them if needed.

How it works

Each macro resizes and positions the window based on screen dimensions. The left and right macros set the width to 50% of the screen and move the window to either edge, while the center macro expands the width to 70% and centers the window. The height for all macros is full height minus the menu bar.

Stream Deck with icons for window management with Keyboard Maestro.

How to set it up

Left Alignment Macro

  1. Add the Move and Resize Front Window action to your new macro.
  2. ➡️ Set horizontal positioning to: SCREEN(Main, Left)
  3. ⬇️ Set vertical positioning to: SCREEN(Main, Top) + MENUBARHEIGHT()
  4. ↔️ Set width to: SCREEN(Main, Width) * 0.5
  5. ↕️ Set height to: SCREEN(Main, Height) - MENUBARHEIGHT()


Right Alignment Macro

  1. Add the Move and Resize Front Window action to your new macro.
  2. ➡️ Set horizontal positioning to: SCREEN(Main, Left) + SCREEN(Main, Width) * 0.5
  3. ⬇️ Set vertical positioning to: SCREEN(Main, Top) + MENUBARHEIGHT()
  4. ↔️ Set width to: SCREEN(Main, Width) * 0.5
  5. ↕️ Set height to: SCREEN(Main, Height) - MENUBARHEIGHT()


Center Alignment Macro

  1. Add the Move and Resize Front Window action to your new macro.
  2. ➡️ Set horizontal positioning to: SCREEN(Main, Left) + SCREEN(Main, Width) * 0.15
  3. ⬇️ Set vertical positioning to: SCREEN(Main, Top) + MENUBARHEIGHT()
  4. ↔️ Set width to: SCREEN(Main, Width) * 0.7
  5. ↕️ Set height to: SCREEN(Main, Height) - MENUBARHEIGHT()


Main
is used for the primary screen. Replace Main with Second to apply the macro to your secondary display.

Adjust to your needs

You can modify these macros to suit your needs. Adjust the width (e.g., remove * 0,7 for full width on the center macro), duplicate them for additional screens, or adjust the height settings to match your preferences.

For an even faster workflow, assign these macros to Stream Deck buttons using the KMLink addon. This lets you reposition windows with a single press.

For more automation and KM tips, take a look at the category page.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.