Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Stephen J. Butler
On Fri, May 10, 2013 at 2:03 PM, Jens Alfke wrote: > #!/bin/sh > open -b com.example.XQIVApp $@ > You probably want this instead to prevent word splitting for elements that have spaces: open -b com.example.XQIVApp "$@" Nothing is ever trivial in sh/bash ;) _

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Jens Alfke
On May 9, 2013, at 11:56 PM, Ondrej Holecek wrote: > No, the "daemon" is the picture viewer itself. It is hidden most of > the time. That doesn’t sound like a daemon or an agent; those types of things run in the background with no UI. Once there’s a UI, you are writing a regular app. If you d

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Robert Vojta
On Friday, 10. May 2013 at 12:47, Ondrej Holecek wrote: > I don't think it would fit sandbox. Or do you have any idea how to > pass command-line application to App Store? :-) > > Just like BBEdit … App in MAS and command line utility downloadable from your website outside of the MAS. ___

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Ondrej Holecek
On Fri, May 10, 2013 at 9:19 AM, Robert Vojta wrote: > On Friday, 10. May 2013 at 9:00, Stephen J. Butler wrote: > > Make launchd run the same executable, but with a "--daemon" option. That's > got to be as easy, or easier, than detecting an already running one and > forking + daemonizing. > > Det

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Ken Thomases
On May 8, 2013, at 5:41 AM, Ondrej Holecek wrote: > The question is, how to force NSApplicationMain() to run in child. > > The basic idea is to do something like this: > > if (already running) { > return cmd_main(argc, argv); > } else { >if (fork() == 0) { >return NSApplicationMain

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Robert Vojta
On Friday, 10. May 2013 at 9:00, Stephen J. Butler wrote: > Make launchd run the same executable, but with a "--daemon" option. That's > got to be as easy, or easier, than detecting an already running one and > forking + daemonizing. Detecting is not so hard … [NSRunningApplication runningAppl

Re: how to run NSApplicationMain() in child process?

2013-05-10 Thread Stephen J. Butler
On Fri, May 10, 2013 at 1:56 AM, Ondrej Holecek wrote: > thanks for the hint, I have to check this first. However at first > glance it seems I have to create 2 applications. Daemon and cmd-line > app. My idea is to have just one app which behaves as a "daemon" in > case the deamon doesn't run yet

Re: how to run NSApplicationMain() in child process?

2013-05-09 Thread Ondrej Holecek
On Fri, May 10, 2013 at 8:14 AM, Stephen J. Butler wrote: > I didn't look at your code, but... one thing to note is that it is > absolutely not secure to run your daemon as root and display a GUI. I hope > that isn't part of your plan. No, the "daemon" is the picture viewer itself. It is hidden m

Re: how to run NSApplicationMain() in child process?

2013-05-09 Thread Stephen J. Butler
I didn't look at your code, but... one thing to note is that it is absolutely not secure to run your daemon as root and display a GUI. I hope that isn't part of your plan. The OS X way to do this sort of thing is to write your daemon as a Launch Agent (since it needs to interact with a logged in u

how to run NSApplicationMain() in child process?

2013-05-09 Thread Ondrej Holecek
Hi, I'm creating a picture viewer controlled from command-line (I call it xqiv which sould be an equivalent to http://www.klografx.net/qiv/ on linux). However, xqiv is slightly different. You have to run xqiv-daemon, which is the window-based application which handles global notifications sent by