gtk-using apps
René J.V. Bertin
rjvbertin at gmail.com
Sat Apr 18 01:47:17 PDT 2015
On Friday April 17 2015 18:54:19 David Evans wrote:
>> We have the app portgroup, which is just a shell wrapper to run a program in $prefix/bin. Is that still the only available option?
I have been working off and on (more off than on) on a version of the old DropScript, exactly with the goal of being able to integrate traditional applications with LaunchServices. It works well enough for me ATM but needs polishing, and officially a reply from the original author to know if and what kind of license we can stick on the code.
For those who are (somehow :)) not aware: LaunchServices does not work like its equivalent on MS Windows, at least not the part that most Mac users interact with. Double-clicking a document, dragging a document onto the app icon do not lead to main being called with argc,argv set to reflect the documents concerned. Events ("messages") are used instead, and you need to declare a principle class that replies to these messages to be able to open the documents. Qt does have some infrastructure in place for that, but it clearly isn't automatic. I have no idea about GTk in this domain.
BTW, it is also possible to send regular arguments via LaunchServices (e.g. `open -a Foo.app --args arg1 arg2 etc`).
It's not impossible to write some code that intercepts the LS messages that can be injected at the head of main, but it given that it works by calling main once more (or doing an exec) it's just as clean to write an external wrapper which (re)creates a proper argc,argv structure.
R.
More information about the macports-dev
mailing list