-->

Disabling dock icon for an app in Mac OSX in diffe

2019-06-13 19:24发布

问题:

In mac osx for most of the applications keeps a dock icon. But if the developer of the same applications wants to hide the dock icon, then how do he hide it?

As a developer i know 'Info.plist' property file is one way to hide the dock icon for an application.

But dont we have any other solution for this?

I hope there should be some other ways as everybody know "there are N no of way of solutions for a problem"

Thanks in advance

M@k4mac

回答1:

If you're developing the app, you want to set LSUIElement to TRUE in your Info.plist.

If you're running the app, you can use a program like Dockless.

If you want superfluous options, use Linux :)



回答2:

The Info.plist solution is the only way to hide the icon from the Dock (for a GUI application).

What are you trying to accomplish? Maybe there's a solution that can be worked out if you give more details.



回答3:

this LSUIElement method is no longer work under 10.8

add Carbon.framework make plist Application is agent (UIElement) =1 checked

// this should be called from awakeFromNib method
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"LaunchAsAgentApp"]) 
{   ProcessSerialNumber psn = { 0, kCurrentProcess };

// display dock icon
TransformProcessType(&psn, kProcessTransformToForegroundApplication);

// enable menu bar
SetSystemUIMode(kUIModeNormal, 0);

// switch to Dock.app
[[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:@"com.apple.dock"    options:NSWorkspaceLaunchDefault additionalEventParamDescriptor:nil launchIdentifier:nil];

// switch back
[[NSApplication sharedApplication] activateIgnoringOtherApps:TRUE];

}


标签: macos hide dock