Move and resize front window

I have two macros for dividing up my screen (a la the many divvy apps for quickly setting window position with hotkeys) . One 50% of the screen, the left side, the other the right side. They still work great, but now El Capitan gives us the option to hide the menu bar. Yet, when I choose to make an app half the screen, it still leaves space at the top for the menu bar... even though the menu bar is now hidden. I wonder if it is possible to make the window span the entire distance.

Does that make sense? Here are two photos. One is the macro as I have it set up. The other is the window scanning the left 50% of the screen... except for the space where the mac menu would be if it wasn't hidden. I can drag the window up, but when I use the macro it leaves that gap.

Here are the two photos:

Macro:

Gap for hidden Mac menu at top:

Any fix for this or ideas I can try?

Check the value of SCREENVISIBLE(Main,Top)

Is it 0 or 22? Post here please, since it’ll be useful to know.

If its 22, then Apple’s API for NSScreen.visibleFrame is not honouring the hidden menu bar.

Alternatively, if it is 0, then the accessibility API is not allowing windows to be resized to that area.

Either way it’s almost certainly an Apple bug.

Peter,

I just checked. Actually my “Window left” and “Window right” macros are slightly different.

Window Right macro:
Screen(Main,MidX)
Screen(Main,Top)+22
Screen(Main,Width)*50%
Screen(Main,Height)-22

Window Left macro:
SCREENVISIBLE(Main,Left)
SCREENVISIBLE(Main,Top)
SCREENVISIBLE(Main,Width)*50%
SCREENVISIBLE(Main,Height)*100%

Don’t know why they are different… I made them both with the popup menus. Oh well. Both give the exact same effect, they resize to 50% left or right, but leave a gap at the top for the hidden Mac menu.

If this is a bug on Apple’s part, I suppose I have to wait till they patch it, eh? Oh well. Thanks for checking it out.

Hey David,

Hmm…

I just recreated your Window Left macro, and it worked perfectly well for me with the Menu-Bar hidden and with it visible.

I’m only running one monitor though – the built-in screen on the MacBook Pro.

Run this AppleScript and see if it moves the front window to the upper-left corner.

tell application "System Events"
  tell (first application process whose frontmost is true)
    set position of front window to {0, 0}
  end tell
end tell

On my system it works whether the Menu-Bar is hidden or not.

Let us know the outcome.

-Chris

I just tried this action:

in 10.11.1, on the Keyboard Maestro editor window, with the menu bar hidden, and the window was made the full size of the screen.

So I am not really sure what the specific case is of this failure.

Hi Peter, Chris-

Sorry for the delayed response. Haven’t had much time to use the computer lately.

Well, I uninstalled Keyboard Maestro, ran Onyx to clean out all system caches, and then reinstalled KM and now things work as expected. I have no idea why that fixed things… but it did. I’ll be sure to try this next time I have problems before asking for help.

Sorry to be a bother. Thanks for trying to help me, and thanks Peter for the awesome app.

-David