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 xqiv-command-line and
displays the image(s). My idea is to have just one application xqiv
which acts as both daemon and/or command-line tool together. If you
run xqiv and the deamon is not running yet it forks and run the
daemon. Parent would act as a commandline tool and child would be the
daemon which stay on background. Parent would sent a notification to
the forked child what image to display and exit. If the daemon is
already running, then fork is not needed and it would just sent the
notification.

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(argc, (const char **)argv);
    } else {
        return cmd_main(argc, argv);
    }
}

The real code is there: http://pastebin.com/7LD2dPK8

When I run NSApplicationMain() in child process, it simply does
nothing. What's wrong?

I have already functional application there:
https://github.com/smrt28/xqiv

It is functional but daemon and command-line tool are two applications.

let me note I'm the beginner in objc/cocoa development and this is my
very first cocoa application.

thanks,

Ondrej
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to