简体   繁体   中英

Remove dock icon for shell executable in Mac OS X?

I know you can remove the dock icon for an app by setting LSUIELEMENT = 1 . I have an executable created by cx_freeze , which bundles a set of Python scripts into a single executable. How can I remove the dock icon, with or without using AppleScript?

My app has some helper command-line tools in one of its frameworks. If the tools are stored in the framework's executable directory, Mac OS X wants to show them in the Dock. Since the tools run quickly, this appears as a brief flash where all the other Dock icons move to make space for the new icon and then move back.

To fix this, I am setting LSBackgroundOnly to true in the Info.plist . LSUIElement would probably also work. Since a command-line tool is just a single file, the way that you set the Info.plist is to have a separate file that Xcode embeds in the binary. You can set this by adding -sectcreate __TEXT __info_plist $(INFOPLIST_FILE) to the OTHER_LDFLAGS build setting. (Hopefully there is a Makefile line or equivalent where you can set this for cx_freeze .)

普通可执行文件(即命令行工具)未显示在扩展坞中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM