I know this is a little old, but I was a little unsatisfied with most of the answers, so I thought I'd leave what I did for anyone who goes looking.
Similar to the python solution, I used a script in hammerspoon.
Hammerspoon is an app that you can give scripts to, and then it will run them in the background. It will handle launching on startup, it has a menu item so you can quit it if you want, its more like a background app/extension. So I personally find it a little more friendly than a python script.
Unlike the python script, my hammerspoon script uses the eventTap. That way it gets notified of mouse move events, and can respond to them instead of running a timer to check to see where the mouse is. That way if you're not moving your mouse it doesn't keep running
mouseEventTap = hs.eventtap.new({hs.eventtap.event.types.mouseMoved}, function(event)
--todo: you could filter with hs.application.frontmostApplication() if you want to only block the menu for certain apps. I don't
local rel = hs.mouse.getRelativePosition()
if(rel.y < 5) then
local frame = hs.mouse.getCurrentScreen():fullFrame()
local abs = event:location()
abs.y = frame.y + 5
local newEvent = event:copy():location(abs)
newEvent:post()
return true
end
end)
mouseEventTap:start()
You can also have additional functions in your script. For example, I made a binding of Ctrl+Alt+Cmd+Space
to enable/disable the event tap. That way if I do want to get to the menu bar, I can.
hs.hotkey.bind({"ctrl", "cmd", "alt"}, "space", function()
if(mouseEventTap:isEnabled()) then
mouseEventTap:stop()
else
mouseEventTap:start()
end
end)
you could alternatively do something like, if the mouse moved within the top 8 pixels of the screen for more than 3 seconds, allow it to move past the 5 pixel barrier at the top of the screen. Or any number of similar methods to temporarily get through and show the menu bar
defaults write
variable one could edit. But so far I've not heard about anything like that. It is especially annoying when using a VM in full screen. Ubuntu has the menubar at the top and I like it that way. But I'm constantly triggering the OSX menu bar to appear. :(