El Capitan+Multimonitor issues

Issue #1:
Secondary/external monitor is active
Click on KM icon, select Launch KM Editor.
Expected: Editor appears on active monitor
BUG: Editor appears on default monitor (MBA)

Issue #2:
Secondary/external monitor is active
Macro/Action “Move and Resize Front Window” is applied to active/focused window that is fully visible on secondary monitor.
Expected: Window is resized on secondary monitor
BUG: Window is moved to default monitor and resized there, using metrics from default monitor.

Could be user error (aka “I can’t find the button to apply things to default monitor”)… educate me!

I note that moving/resizing apps in HyperDock works as expected. I don’t know if they’re using undocumented API (boo) or not…

HW: 13" MBA mid-2013
Dell external monitor

SW: El Capitan 10.11 (worked fine in Yosemite)
KM 7.0.1

Hey Mark,

Look at this:

If that doesn't help use it to search a bit more on the forum.

If you still need help then holler.

-Chris

Thank you, Chris, for this pointer. It appears that installing El Capitan (for me), set the primary menu bar to be back onto my laptop from the external which caused SCREEN(Main) to move the windows there.

User error!

Hey Mark,

Glad you solved it.

Hmm… Perhaps that needs to be in the wiki.

-Chris

I have this other issue: I’m trying to create a macro that will:

  • Take a Chrome window with title Tabs Outliner and make it full height on the left of the external monitor with width 20% of the screen.
  • AND
  • Take all other Chrome windows and make them full height on the right of the external monitor with 80% width.

I can’t find anything in KM directly that will let me do this. Do I need to descend to Javascript?

Hey Mark,

The easy way to do that is going to be with AppleScript.

But it takes a little finagling, because AppleScript sees a multi-monitor setup as one big Desktop.

------------------------------------------------------------
# How to get the bounds of the front window.
------------------------------------------------------------
tell application "Google Chrome"
  set winBounds to bounds of front window
end tell
------------------------------------------------------------

This snippet just sets two variables to a list.

------------------------------------------------------------
# Window Bounds are:
# x1,y1 == Upper left corner .
# x2,y2 == Lower right corner.
------------------------------------------------------------
set tabsOutlinerWinBounds to {x1, y1, x2, y2}
set otherWinBounds to {x1, y1, x2, y2}
------------------------------------------------------------

You can calculate the size, but the simplest way to start is to manually arrange your windows, get the bounds, and emplace that value appropriately in the script.

------------------------------------------------------------
# Working Script
------------------------------------------------------------
set tabsOutlinerWinBounds to {0, 23, 400, 1196}
set otherWinBounds to {400, 23, 1920, 1196}
tell application "Google Chrome"
  set tabsOutlinerWin to windows whose title is "Tabs Outliner"
  set bounds of windows whose title is "Tabs Outliner" to tabsOutlinerWinBounds
  set bounds of windows whose title is not "Tabs Outliner" to otherWinBounds
end tell
------------------------------------------------------------

The attached macro lists windows Keyboard Maestro can see.

I use it as a diagnostic tool, and you can deconstruct it to see how to iterate through windows and get information about them.

-Chris


List Windows Keyboard Maestro Can See v1.0.kmmacros (4.6 KB)

1 Like

It's in the wiki already:

“Main - the screen with the primary menu bar (as configured in the Displays preferences).”

https://wiki.keyboardmaestro.com/function/SCREEN

-Chris