删除 Mac OS X 中 shell 可执行文件的停靠图标?
我知道您可以通过设置 LSUIELMENT = 1 来删除应用程序的停靠栏图标。我有一个由 cx_freeze 创建的可执行文件,它将一组 Python 脚本捆绑到一个可执行文件中。如何使用或不使用 AppleScript 删除停靠栏图标?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
普通可执行文件(即命令行工具)不会显示在扩展坞中。
Ordinary executables (i.e. command line tools) do not show up in the dock.
我的应用程序在其框架之一中有一些辅助命令行工具。如果工具存储在框架的可执行目录中,Mac OS X 希望在 Dock 中显示它们。由于工具运行速度很快,因此会出现短暂的闪烁,所有其他 Dock 图标都会移动以为新图标腾出空间,然后移回。
为了解决这个问题,我在
Info.plist
中将LSBackgroundOnly
设置为true
。LSUIElement
可能也可以工作。由于命令行工具只是一个文件,因此设置Info.plist
的方法是让 Xcode 嵌入到二进制文件中的单独文件。您可以通过将-sectcreate __TEXT __info_plist $(INFOPLIST_FILE)
添加到OTHER_LDFLAGS
构建设置来进行设置。 (希望有一个 Makefile 行或等效行,您可以在其中为cx_freeze
设置此项。)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
totrue
in theInfo.plist
.LSUIElement
would probably also work. Since a command-line tool is just a single file, the way that you set theInfo.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 theOTHER_LDFLAGS
build setting. (Hopefully there is a Makefile line or equivalent where you can set this forcx_freeze
.)