如何更改OS X应用程序包中的可执行文件 [英] How to change the executable in an OS X Application Bundle
问题描述
但是,在OS X不能做到这一点很好,因为我最终在码头上有两个图标。一个为我的脚本变成了一个应用程序&另一个用于Firefox应用程序。我宁愿只有一个码头图标&不要打破Firefox的更新。
我现在的解决方案是重命名MacOS / firefox {, - bin}前缀为real-,然后命名我的shell脚本firefox-bin。这个工作,但我很确定,下次firefox尝试更新自己我敬酒。
我试着改变CFBundleExecutable
任何人都可以提供其他建议吗?
创建一个常规应用程序包,但是在其上设置 LSUIElement
,这样脚本应用程序的图标就不会被停放,并将Firefox 包含在包中。
#!/ bin / sh
在前>& 2
$ 1 /内容/资源/ Firefox.app/Contents/MacOS/firefox-bin
在>& 2
后回显
你得到如下输出:
4/8/09 1:16:33 PM [0x0-0x801801] .net.sabi .PlatypusScript [76610]
之前4/8/09 1:16:35 PM firefox-bin [76613]数据库加载时间:0.373( 717个对象)
4/8/09 1:16:35 PM [0x0-0x801801] .net.sabi.PlatypusScript [76610]
2009-04-08 13:16:35.699 firefox-bin [ 76613:10b]数据库加载时间:0.373(717对象)
2009年8月8日下午1:16:57 [0x0-0x801801] .net.sabi.PlatypusScript [76610]
如果您的用户以其他方式启动Firefox,例如使用URL处理程序和打开HTML文件,则需要使用本地应用程序,它可以将相应的Apple事件传递给Firefox,并将相应的URL和文件处理程序信息添加到Info.plist。 ( aemreceive 是一个方便的苹果事件接收的Python包装。)
I would like to run a script before Firefox starts & after it quits. In Ubuntu I do this by creating a new shortcut that calls my function first, then calls the firefox command, then calls my last function. Since the firefox command blocks until the application quits, my last function is called immediately after the process ends.
However, in OS X I cannot do this as nicely because I end up with two icons on the dock. One for my script turned into an application & another for the Firefox application. I would prefer to just have one dock icon & to not break Firefox updates.
My current solution is to rename both MacOS/firefox{,-bin} to be prefixed with 'real-" and then name my shell script "firefox-bin". This works, but I am pretty sure that the next time firefox tries to update itself I am toast.
I have tried changing the "CFBundleExecutable" property in the bundle's Info.plist file to be my script, but that doesn't work.
Can anyone offer any other suggestions?
Create a regular application bundle but set LSUIElement
on it, so the script application's icon is hidden from the dock, and include Firefox inside the bundle.
A simple way of doing this is with Platypus. Configure Platypus as follows:
Click "Parameters". Check the "Set $1 to path to application" checkbox, so your script can reference files inside the bundle.
Check "Runs in background"—this sets
LSUIElement
for you.In the list of "Files and folders to be bundled with application into the Resources folder", drop Firefox.
Change Output to "None" so your log messages go to the system console.
Drop Firefox's icon file (firefox.icns) on the "Custom Icon" well.
Change "App Name" to Firefox.
For a script that looks something like this:
#!/bin/sh
echo before >&2
$1/Contents/Resources/Firefox.app/Contents/MacOS/firefox-bin
echo after >&2
you get output like:
4/8/09 1:16:33 PM [0x0-0x801801].net.sabi.PlatypusScript[76610] before
4/8/09 1:16:35 PM firefox-bin[76613] Database load time: 0.373 (717 objects)
4/8/09 1:16:35 PM [0x0-0x801801].net.sabi.PlatypusScript[76610]
2009-04-08 13:16:35.699 firefox-bin[76613:10b] Database load time: 0.373 (717 objects)
4/8/09 1:16:57 PM [0x0-0x801801].net.sabi.PlatypusScript[76610] after
If your users launch Firefox in other ways, such as with URL handlers and by opening HTML files, you'll instead need to use a native application, which can pass the appropriate Apple Events through to Firefox, and add the appropriate URL and file handler information to the Info.plist. (aemreceive is a convenient Python wrapper for Apple Event reception.)
这篇关于如何更改OS X应用程序包中的可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!