Objective-c – Auto-hide the OS X menu bar system-wide

cocoacode-injectionmacosobjective c

I wish to write a utility to auto-hide the menu bar, much like the dock. This would
replicate the a OS X 10.4-only application "Menufela", but for Snow Leopard.

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

This code auto-hides the menu bar (and dock), but only in when the application is the frontmost window. How would I go about applying this behaviour system wide, regardless of what application is open?

The only thing I can think of is an InputManager, but I haven't written one before, thus I'm unsure if this is the correct way to go about it..

Also it seems InputManagers are limited as of Leopard/Snow Leopard – from this SO question:

it won't run them in a process owned by root or whell, nor in a process which has modified its uid. Most significantly, 10.5 won't load an Input Manager into a 64 bit process and has indicated that even 32 bit use is unsupported and will be removed in a future release.

I'm not concerned about the "will be removed in a future release" (it just has to work on Snow Leopard), and I don't think root-owned processes are an issue (all GUI applications should be running as the current), but presumably the code would have to be injected into many 64-bit applications (Finder/Safari/etc)

(I originally asked this on SuperUser, here, but as there was seemingly no existing utility to achieve this, it's more relevant to StackOverflow)

Best Answer

The kiosk API is probably your best bet for this, though I haven't used it in years and don't know if it's even supported anymore.

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