Disabling dock icon for an app in Mac OSX in different way

情到浓时终转凉″ 提交于 2019-12-08 11:16:52

问题


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];

}


来源:https://stackoverflow.com/questions/5193618/disabling-dock-icon-for-an-app-in-mac-osx-in-different-way

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!