Crazor / MenuBarHider

Small SIMBL plugin to auto-hide Mac OS X's menu bar
http://github.com/Crazor/MenuBarHider
49 stars 3 forks source link

eclipse cocoa compatibility #3

Open 01tobeornottobe opened 13 years ago

01tobeornottobe commented 13 years ago

The MenuBarHider SIMBL plugin seems to crash eclipse-SDK-3.6.1-macosx-cocoa-x86_64 and also the 32-bit version of it. Moving the plugin from the Library solves the problem with eclipse. Also when starting eclipse in -debug mode, the last entry is about loading MenuBarHider or something similar...

But, as MenuBarHider is the neatest app for hiding the menu bar that I know of, I am interested in any workarounds or improvements that could be done, e.g. I would be satisfied, if the plugin works with a kind of "whitelist" of applications, that can use the plugin. Other apps shouldn't even see, that the plugin exists... hm, maybe that is not possible... however, any ideas?

ps: I am running Snow Leopard 10.6.4 on a new MBR (Intel, i5) with a brand new OS install.

edit: more info: I am using Crazor-MenuBarHider-bc71ce6.zip and built the plugin from this source with xcode myself. The plugin seemed to work as supposed until I wanted to run eclipse.

The question is who is "responsible" for this problem? Does the plugin fulfill the Apple conventions? Does eclipse handle SIMBL-plugins right (must it do so?) ?

Crazor commented 13 years ago

Thanks for reporting. I am aware of the issue (someone reported it via mail last week) but haven't found a solution yet. I suspect other Java SWT apps could be affected, too.

I didn't know about the -debug option of Eclipse and will have a look at what it reports.

Whitelisting is possible by editing the Info.plist. Have a look at the SIMBLTargetApplications key. You can remove the wildcard and add the app's CFBundleIdentifier (from the app's plist) instead. Duplicate as necessary.

I think blacklisting is not supported. I'll see if I can cobble some feature together that reads a blacklist from a plist. Maybe there is an easy way to check if the bundle was loaded into a Java application, too.

01tobeornottobe commented 13 years ago

Thanks a lot for your helpful answer! I am quite happy with the whitelist solution and it seems to work.

Well, Apple really should add this feature to OSX, I have no idea why they still hide it.

But, thanks for your plugin, keep up the good work :)

Crazor commented 13 years ago

I traced this down to a problem with SIMBL. GDB tells me

warning: Could not find object file "/Users/mike/Projects/simbl/build/SIMBL.build/Deployment/SIMBL.build/Objects-normal/i386/NSAlert_SIMBL.o" - no debug information available for "/Users/mike/Projects/simbl/src/NSAlert_SIMBL.m".

warning: Could not find object file "/Users/mike/Projects/simbl/build/SIMBL.build/Deployment/SIMBL.build/Objects-normal/i386/SIMBL-4A64B91627DFD16A.o" - no debug information available for "/Users/mike/Projects/simbl/src/SIMBL.m".

warning: Could not find object file "/Users/mike/Projects/simbl/build/SIMBL.build/Deployment/SIMBL.build/Objects-normal/i386/SIMBLPlugin.o" - no debug information available for "/Users/mike/Projects/simbl/src/SIMBLPlugin.m".

I reported the issue here: http://code.google.com/p/simbl/issues/detail?id=41

01tobeornottobe commented 13 years ago

Hello Crazor, do you know if it would be possible to make a PreferencePane that allows setting a global preference for the menu bar as it is possible for the dock (maybe including a whitelist or a blacklist, if needed). If not, do you know why the dock can be set globally, but not the menu bar?

If it is possible to create this PreferencePane I would think about following this path. Otherwise I think, that a GUI for adding and deleting BundleIdentifiers of applications from the Info.plist would be truly helpful for the average user. Also I would set the default Info.plist to only hide the menu bar for most used OSX software like Safari, Preview, TextEdit and so on, to avoid conflicts.

Crazor commented 13 years ago

Unfortunately, the upstream issue was closed as invalid.

01tobeornottobe, I seem to have missed your comment. Don't know why I didn't get any notification. What you suggest is not possible without doing what this SIMBL plugin does. The reason for that is that Apple doesn't want you to be able to do this. Why they don't want us to hide the menu bar, but allow to hide the dock is beyond my comprehension.

Regarding the black-/whitelisting: I haven't had time to implement this feature yet, but anyone is free to submit a pull request or a patch.

01tobeornottobe commented 13 years ago

Hello Crazor,

As OS X Lion is already out now, I am not really interested in investing time in a Snow Leopard project any more. But anyway, your plugin together with my custom whitelist work flawlessly on my Snow Leopard machine. As you suggested, I created the "whitelist" by simply editing the Info.plist of the SIMBL plugin. The interesting part of the original Info.plist file:

SIMBLTargetApplications
<array>
    <dict>
        <key>BundleIdentifier</key>
        <string>*</string>
    </dict>
</array>

I edited it to something like:

SIMBLTargetApplications
<array>
    <dict>
        <key>BundleIdentifier</key>
        <string>com.apple.Preview</string>
    </dict>
    <dict>
        <key>BundleIdentifier</key>
        <string>com.apple.Safari</string>
    </dict>
</array>

You can repeat as many tags you need to, in order to whitelist all applications where you want the MenuBarHider plugin to be active. For some applications this may make some trouble (e.g. Eclipse). The following applications seem to work correctly together with the MenuBarHider (no problems since more than half a year):

com.apple.Terminal com.adiumX.adiumX com.apple.iTunes com.apple.iWork.Pages com.apple.iWork.Numbers com.apple.iWork.Keynote com.microsoft.Excel com.microsoft.Powerpoint com.microsoft.Word com.apple.Stickies org.openoffice.script com.skype.skype com.barebones.textwrangler com.apple.TextEdit com.apple.mail org.mozilla.firefox com.apple.Preview com.apple.Safari
Crazor commented 13 years ago

Sure, whitelisting is supported by SIMBL. But blacklisting would be more appropriate in this case, I guess.

FYI, SIMBL and MenuBarHider are working just fine on Lion!

Am 14.07.2011 um 00:43 schrieb 01tobeornottobe reply@reply.github.com:

Hello Crazor,

As OS X Lion is already out now, I am not really interested in investing time in a Snow Leopard project any more. But anyway, your plugin together with my custom whitelist work flawlessly on my Snow Leopard machine. As you suggested, I created the "whitelist" by simply editing the Info.plist of the SIMBL plugin. The interesting part of the original Info.plist file:

SIMBLTargetApplications BundleIdentifier *

I edited it to something like:

SIMBLTargetApplications BundleIdentifier com.apple.Preview BundleIdentifier com.apple.Safari

You can repeat as many tags you need to, in order to whitelist all applications where you want the MenuBarHider plugin to be active. For some applications this may make some trouble (e.g. Eclipse). The following applications seem to work correctly together with the MenuBarHider (no problems since more than half a year):

com.apple.Terminal com.adiumX.adiumX com.apple.iTunes com.apple.iWork.Pages com.apple.iWork.Numbers com.apple.iWork.Keynote com.microsoft.Excel com.microsoft.Powerpoint com.microsoft.Word com.apple.Stickies org.openoffice.script com.skype.skype com.barebones.textwrangler com.apple.TextEdit com.apple.mail org.mozilla.firefox com.apple.Preview com.apple.Safari

Reply to this email directly or view it on GitHub: https://github.com/Crazor/MenuBarHider/issues/3#issuecomment-1566822

01tobeornottobe commented 13 years ago

Well, in general, you are right about blacklisting. But given the fact, that the MenuBarHider might cause troubles with some applications, the safer way is to whitelist only apps, that really need this feature (mainly browsers and text editors). This way I am avoiding unexpected problems, especially when installing new apps.

So, should I closed that issue, or do you still want to work on it?

Crazor commented 12 years ago

There seems to be an undocumented blacklisting function in SIMBL. I stumbled over it while reading SIMBLs source code looking for some other problem.

Try running defaults write net.culater.SIMBL "SIMBLApplicationIdentifierBlacklist" '("org.eclipse.eclipse")' to add Eclipse to SIMBLs blacklist. This assumes that you don't have any other application blacklisted. If you have, this command will certainly destroy your blacklist! You should check ~/Library/Preferences/net.culater.SIMBL.plist if it already contains the key SIMBLApplicationIdentifierBlacklist before running the defaults command.

This blacklist is global, meaning adding an application to this blacklist will prevent SIMBL from injecting any code to it. This is probably what you want for Eclipse anyway. I assume that Eclipse crashes because of the injection process itself, and not because of MenuHider's code, but I haven't tested it.