Auto-hide OS X menu bar system-wide

I want to write a utility to automatically hide the menu bar, just like the docking station. This replicates the OS X 10.4 "Menufela" app, but for Snow Leopard.

[[NSApplication sharedApplication]
     setPresentationOptions:   NSApplicationPresentationAutoHideMenuBar
                             | NSApplicationPresentationAutoHideDock];

      

This code will automatically hide the menu bar (and dock), but only when the application is the front-most window. How can I apply this behavior system no matter which application is open?

The only thing I can think of is the InputManager, but I haven't written it before, so I'm not sure if this is the correct way to do it.

Also it seems that InputManagers are limited as Leopard / Snow Leopard - from this SO question :

it will not run them in a process owned by root or whell, nor in the process that changed its uid. Most importantly, 10.5 will not load the Input Manager into a 64-bit process and indicated that even 32-bit usage is not supported and will be removed in a future release.

I'm not worried about "will be removed in a future version" (it just needs to work on Snow Leopard) and I don't think root resource issues are an issue (all GUI apps should run as current), but presumably , the code has to be injected into many 64-bit applications (Finder / Safari / etc)

(I originally asked this on SuperUser, here , but since no utility seemingly exists to achieve this, this is more relevant to StackOverflow)

+2


source to share


4 answers


The kiosk API is probably the best choice for this, although I haven't used it in years and don't know if it supports it even more.



http://developer.apple.com/mac/library/technotes/tn2002/tn2062.html

+2


source


I put together a little SIMBL plugin to hide the menu bar: http://github.com/Crazor/MenuBarHider It uses Carbon's SetSystemUIMode () call, which is not limited to 32-bit applications.



+2


source


I haven't used it on Snow Leopard myself, but the only injection method on the system that even has a chance, as far as I know, is mach_star , and even that would be a little tricky. Apple doesn't make it easy these days, which is why many old hacks cannot be updated in a timely manner or at all.

+1


source


This recent Cocoa With Love article has information on how to hide the menu bar:

http://cocoawithlove.com/2009/08/animating-window-to-fullscreen-on-mac.html

However, using CarbonAPI ( SetSystemUIMode()

) requires the application to be 32-bit and not run outside the scope of the application.

Edit: and read a little, it seems like this API doesn't do anything it -[NSApplication setPresentationOptions]

can't do.

+1


source







All Articles