Automating window management when connected to an external display. Could use some advice

Hey all! I’m currently working on figuring out a way to automate my setup so that, whenever I connect a second display to a laptop, it:

  1. Opens and moves certain apps to split view on the second display (mail & safari)
  2. Opens certain apps in full screen in 3-4 spaces on the main display (messages, slack, etc.)

The impetus for this is that I often have client meetings that require me to exit apps that may have any sensitive information on them beforehand, and I’d love to create an automation for whenever I return to my desk, I’d like to have it recognize the connection to an external monitor as the trigger for recreating the standard window and display setup I use most often.

I’ve figured out how to do the first item with Moom, which pretty much works perfectly when using its “automatically activate when connected to a 2nd display” feature. It seems like the second item should be possible with Keyboard Maestro, but I’m not sure I know the application well enough to make it work. The tricky thing here is it needs to open apps in full screen, not just open and arrange windows around the same screen.

Any thoughts on how to solve this second issue?

Thanks all!

KM can send key presses so I guess at worst you could switch focus and full screen an app like that though I’m sure there may be other options too.

When connecting to your monitor, you aren’t by any chance also switching from wireless to wired network are you. I know that KM can definitely detect that sort of change.

I think this post on the KBM forum might help solve your spaces issue. Its a bit complex and depends on defining custom shortcuts in Keyboard preferences.

For the move and resize windows, you might look at the “move a window” command. Specifically, you can use the “move and resize” subcommand, which has presets for left half and right half.

So you could:

  • if when you plug in the monitor you also plug in a USB device (webcam? USB drive?), set the trigger to be “USB Device”. Or trigger with a keybinding, or a mouse gesture. Or maybe even a certain network?
  • open all the apps you want open
  • for the ones that go full screen, use Resize a Window / Move and Resize / Full Screen
  • then use the spaces trick in the link above to move things as you like
  • then use Resize a Window again to move Mail.app and Safari to wherever you like them.
2 Likes

You rock, thank you for your input! That’s a very clever idea for getting around this problem. I’ll give it a whirl today and see if I can make that implementation work.

1 Like