Automating a dock with multiple monitors

Here’s my situation:

MBP connected to a dock with an external monitor. At times I connect my iPad pro as a second external monitor.

When I’m not working it’s not connected to the dock.

I set up three KM macros to reorder my window placement for the apps I usually use. Firefox, BusyCal, etc.

However, lately I’ve found that KM doesn’t seem to recognize the changes when I unplug from the dock and then return. I use the SCREENVISIBLE() in Move and Resize front window action. For example:

SCREENVISIBLE(Second,MidX)
SCREENVISIBLE(Second,Top)
SCREENVISIBLE(Second,Width)*50%
SCREENVISIBLE(Second,Height)

That will work (and place my window on the right side of the external monitor), but then if I disconnect the dock and then come back, especially if I’ve turned on the iPad as an extra monitor, it forgets which monitor is second.

So, I’m wondering what I’m doing wrong. And/or I’m wondering if there’s something I can do when I undock to help the machine remember the monitors. I already have an undocking script to unmount my time machine drive (connected to the dock), so adding something to that is trivial. :slight_smile:

Thanks!

Based on your description and the relevant documentation, it seems to me that the problem is related to the arrangement of the displays as seen in System Preferences -> Displays. As a way of troubleshooting, I suggest you monitor the layout in System Preferences while you connect/disconnect your iPad and external monitor. If the layout changes, that’s most likely your problem.

You could also try to bypass the dock and connect your MBP directly to the monitor using an HDMI cable. That way, you can rule out the dock.