AutoRaise icon indicating copy to clipboard operation
AutoRaise copied to clipboard

When using autohide menu bar on an external monitor, hovering over the menu bar raises the window underneath

Open alexclaydon opened this issue 2 years ago • 2 comments

Hello, this is such a great utility. No "focus-follows-mouse" is always the thing I miss most from Linux.

I noticed that when using the MacOS autohide menu bar setting with an external monitor, hovering over the menu bar (in its revealed state, on top of any windows underneath) raises the window underneath, preventing access to the menu bar. I wondered if this is a bug; it seems to me as though any window obscured by a visible menu bar should not be raised.

alexclaydon avatar Apr 16 '22 08:04 alexclaydon

@alexclaydon Thank you for this bug report. I am indeed not entirely sure if this is a bug and if this can be solved easily. I will need some time to analyse.

sbmpost avatar Apr 19 '22 15:04 sbmpost

@alexclaydon I did some analysis, and this is indeed a difficult problem to solve. The menu bar is an application owned object and as such it is difficult to know whether it is currently hiding or not. Because if it is visible, we don't want to raise the windows underneath, but if it is hiding, we do. The only solution I can currently think of, is that if the mouse is within the area where the menubar resides (without knowing if it is visible), we don't raise. But that is probably not the solution you are looking for.

sbmpost avatar May 19 '22 15:05 sbmpost

I ran into this and this solution would actually work for me. This issue happens on a macbook with no external displays.

Alternatively, being able to specify a dead zone of X pixels around the edge of the screen might also be a way to address this (where auto-raise would not happen). Getting fancier, you could also choose a different deadzone based on the top, bottom, left/right edges of the screen.

zi0r avatar Oct 27 '22 02:10 zi0r

Just chiming in (after some months!) to say that this solution would work great for me too! I still use Auto-Raise all the time for certain workflows.

alexclaydon avatar Oct 27 '22 02:10 alexclaydon

@zi0r @alexclaydon It is probably going to be an option then. Currently I have no time however to implement it due to personal circumstances. As soon as this situation changes, this issue will be in my list of things to pick up. In the meantime let me think of a quick patch (if possible)...

sbmpost avatar Oct 31 '22 16:10 sbmpost

@zi0r @alexclaydon

Assuming you guys use the self compiled version, you might try with the patch below:

float menuBarHeight = 25;
// float menuBarHeight =
// NSHeight(screen.frame) - NSHeight(screen.visibleFrame) -
// (screen.visibleFrame.origin.y - screen.frame.origin.y) - 1;

sbmpost avatar Oct 31 '22 16:10 sbmpost

Any chance to get this committed to a release package? AutoRaise is a great improvement over native MacOS clumsiness when apps constatly try to steal focus from one another, but if an app has a small window at distance from the menubar, it's nearly impossible to open this app's menu unless the window is moved right under the bar, please see the video below:

https://user-images.githubusercontent.com/4336560/208229902-699c76c0-4ea6-4719-a376-90abca0782c0.mov

Settings used: image

Seems like the menubar is "transparent" in autohide mode, i.e. autoraise sees an app under the bar and raises its window. Hope it makes sense, I guess this is what this issue is about anyway.

movy avatar Dec 17 '22 07:12 movy

@movy

Any chance to get this committed to a release package?

Are you referring to the patch I suggested? I never really got feedback if it works ;-)

sbmpost avatar Jan 01 '23 11:01 sbmpost

@sbmpost , yes, the patch seems to offer a fix for this behaviour, but I never had experience with building MacOS binaries, so would be grateful if someone can make a binary with the patch. I will test it and post back :)

movy avatar Jan 08 '23 15:01 movy

@movy Below you will find a zip with patched AutoRaise dmg.

AutoRaise-patched.zip

I will test it and post back :)

Please do :-)

sbmpost avatar Jan 17 '23 10:01 sbmpost

Thanks! I tried the patched version, unfort. it's the same behaviour -- even with 200-300ms delay whenever I move the cursor to unhide the menubar, AutoRaise raises a maximised app underneath the bar (most often Chrome), i.e. same thing as in the video above. So if an app is not maximized/full screen, I have to move its window to the top-left corner in order to catch its menubar.

movy avatar Jan 19 '23 05:01 movy

@movy Will have a look asap. Your video is very helpful indeed

sbmpost avatar Jan 19 '23 22:01 sbmpost

@alexclaydon @zi0r So it would seem I finally got the auto hiding menubar issue fixed in version 3.7 without having to introduce parameters or hacks :-) The only case where it still breaks is when hovering the application icons on the top right of the menubar but I hope this is acceptable.

This fix is not in master yet because I am preparing a few other fixes as well. If in the meantime you want to test this, you can compile manually using branch: fix-collected-issues

@movy The issue in your video is actually unrelated to this issue. In your case, what you probably want to do, is hold the "CTRL" key while navigating to the menu to temporarily disable AutoRaise. Navigating to the menu if there is another app 'in between' in combination with auto raise/focus has always been an issue on OSX. The best one can do is come up with some workaround: In this case the CTRL key.

sbmpost avatar Mar 01 '23 17:03 sbmpost

cool, thanks, I did not know about CTRL trick. Now I see it's mentioned at the very bottom of the settings window :)

movy avatar Mar 02 '23 04:03 movy