开发者

How to hide application icon from Mac OS X dock

开发者 https://www.devze.com 2023-01-27 23:56 出处:网络
I have a wxpython script, which creates a wx.App and a frame, hides it and does some processing using hidden frame. I do not want this script\'s icon to appear in Ma开发者_Go百科c dock but it comes. S

I have a wxpython script, which creates a wx.App and a frame, hides it and does some processing using hidden frame. I do not want this script's icon to appear in Ma开发者_Go百科c dock but it comes. So how can i hide it, I did not find anything in wxPython so it there some carbon API which I can call?

Simplest python script makes icon to appear

>>> import wx
>>> app = wx.App()


I was not able to find a way to hide app icon programmatically, only way seems to be to set LSUIElement=1 in Info.plist, so the apps which need to switch on and off icon depending on user option may have to have two app which share all the code using symbolic links except the info.plist files which will be different for different mode app.

Anyway this explains it better

http://codesorcery.net/2008/02/06/feature-requests-versus-the-right-way-to-do-it


Using this AppKit code before load your app:

from AppKit import NSBundle
bundle = NSBundle.mainBundle()
info = bundle.localizedInfoDictionary() or bundle.infoDictionary()
info['LSUIElement'] = '1'
0

精彩评论

暂无评论...
验证码 换一张
取 消