Taming the menu bar in mac os full screen apps

Recently I’ve switched from using VMWare Fusion to Microsoft Remote Desktop for my windows needs (thanks a lot apple for screwing me over with the switch from intel). And one of the biggest problems that I’ve been struggling with has been that while VMWare Fusion does a remarkable job preventing the mac os menu bar from opening on your full screen VM, Microsoft Remote Desktop does no such favors. And it is annoying.

When trying to build/run my applications, I often go to the IDE menu bar. Where i run my mouse along the top of the screen until it ends up on the right option. But unfortunately, now that just means that I open the mac os menu bar. Want to close the browser, nah, you want to open mac os notification center (why is that even a thing). How about opening a file menu? no, you clearly meant to close your RDP window. There’s CLEARLY nothing else you could have intended.

 

After doing some internet research, my findings were

  • There is no setting for mac os, hidden or otherwise, to configure how long it takes the menu bar to come down in full screen apps
    • there’s clearly something hidden, because if you use citrix there’s some kind of citrix options that make it happen, but if you’re not using citrix too bad
  • There’s no per app setting to configure the menu bar
  • There’s a way to make the menu bar perpetually visible for full screen apps, but there is no way to make it perpetually hidden for full screen apps

The lengths which people go through to try and resolve this is astonishing. There’s someone who re-did the firefox’s CSS to move the tabs from the top of the screen to the bottom. There’s a paid app on the app store to change the color of the menu bar to “hide” it by just making it always visible, but in an ignorable color. And the closest to a working solution I found, a python script that runs a timer to check every tenth of a second where your mouse is, and move it away from the top of the screen so the menu wouldn’t open. Which someone found too infrequent, so people make it check more often. Trying to balance the frequency of their mouse checks with cpu usage.

 

Enter, solving the problem on my own.

By using the eventTap, you can monitor events on a global level to track the mouse, and move it if it’s too close to the top of the screen. Unlike the python solution, it doesn’t run when the mouse isn’t moving. And you aren’t trying to balance the resource utilization of your code with the potential of the timer not running often enough.

Rather than writing my own objective-c app for this like I’ve done in the past, or writing the same thing in swift, I decided instead to use Hammerspoon.

Hammerspoon is an app that allows you to write scripts for all sorts of stuff. It handles launching on startup, it can do keyboard or mouse things, it has a console to make debugging scripts faster than launching xcode, and it centralizes all sorts of scripts for things like this into a single app. And of course the most important feature of all, I’m already using it for other stuff.

 


Once Hammerspoon is installed, click on the menu icon and go to Open Config which will open your init.lua script in your editor.

You can configure Hammerspoon to not have a menu icon, in which case you will just have to open ~/.hammerspoon/init.lua manually.

You can put all this code into its own file, and just import it into your init script if you want. That can help you to keep things isolated, but that’s up to you to google, because how you manage your scripts doesn’t really impact me. 🙂

This is what I’ve landed on as a script that keeps me happy enough.

It blocks the mouse from moving within the top 5 pixels of the screen. I found that to be the most consistent distance.

It uses the event tap so that it isn’t wasting resources. I’ve found that the cpu usage of this script is only about 1.4% while I am constantly moving my mouse. But since it uses the event tap, it doesn’t do anything if you aren’t moving your mouse.

The script works with multiple monitors, even if they aren’t aligned. And could easily be modified to make it so some applications block the menu bar from showing, and others don’t. I didn’t do that, because I realized that this solves the annoyance of teams opening the menu bar when I try to leave a meeting or unmute myself.

I also implemented a keyboard shortcut to disable the wall for when I actually do need to get the menu bar to come down. However, I found that I kept forgetting to re-enable it. So instead of doing shortcut to turn it off, shortcut to turn it on, I landed on using a timer, and mouse location to determine if I’ve “finished” having my mouse at the top of the screen.

Though its really easy to modify the script to work differently

 

Leave a Comment

Your email address will not be published. Required fields are marked *