0

I have a problem with my app written in C++.

After I started my app, it run 3 subprocesses. In the activity monitor it looks so: MyApp - process1 - process2 - process3

process1 is a vncserver. If a client connects, the "process1" is now called "MyApp" and a second icon appears in the Dock. I searched out that the icon appears after the function "select(..)" is called. Why happened this?

If I call this at startup of process1 (in a external .mm file)

[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited];

the second icon appears for very short time but disappears immediately. This solves my problem. But now my "process1" (now called "MyApp") is tagged as "not responding" in the activity monitor. The process runs and responds to the client. OSX now thinks my subprocess is a GUI process and tagged it with "not responding". How can I prevent this?

EDIT:

The process "MyApp" starts 3 processes, a vncserver, a ftp client and a ssh client. The ftp and ssh client work fine. But the vncserver changes his process name and shows a second Dock icon. If I disable the icon, the process is tagged as "not responding" but still answers to connected clients.

The user may be confused about the second dock icon or the not responding process and thinks something went wrong.

plettix
  • 133
  • 2
  • 9

2 Answers2

0

If you set the LSUIElement flag in the Info.plist for the relevant process, it will stop the icon appearing in the doc.

So add this to the info.plist file: -

<key>LSUIElement</key>
<true/>

This is documented under Launch Services.

TheDarkKnight
  • 27,181
  • 6
  • 55
  • 85
  • The problem is that my app should stay in the Dock, but only once. – plettix Jun 12 '14 at 13:59
  • Sorry, then, I'm not sure I understand your question. What do you mean by 3 subprocesses? I assumed it was 3 applications where one launches the other two and you wanted the other two to stop displaying in the dock. – TheDarkKnight Jun 12 '14 at 15:38
  • the process "MyApp" starts 3 processes, a vncserver, a ftp client and a ssh client. The ftp and ssh client work fine. But the vncserver changes his process name and shows a second Dock icon. If I disable the icon, the process is tagged as "not responding" but still answers to connected clients.The user may be confused about the second dock icon or the not responding process and thinks something went wrong. – plettix Jun 13 '14 at 07:34
  • That's much clearer. I would suggest you change your question to include the comment you've made here. – TheDarkKnight Jun 13 '14 at 07:49
  • Done. I hope now its better to understand – plettix Jun 13 '14 at 10:58
  • So, if I understand correctly, you have one application which is just responsible for launching the other 3 applications? If so, I suggest you change the design. I would expect the vncserver to be a daemon process, with no UI, which is running independently and would have the LSUIElement set in its plist. The FTP and SSH clients should either be separate applications or just one with the functionality of both FTP and SSH. – TheDarkKnight Jun 13 '14 at 12:22
  • No, my application is the main process (GUI, network) and the vncserver, FTP and SSH clients are only helpers. Changing the design is no option, because thats too much additional work for my company I'm workung for. – plettix Jun 13 '14 at 16:12
  • And are those helpers separate app bundles? – TheDarkKnight Jun 13 '14 at 16:27
  • No, the helpers are single executables like command line tools. – plettix Jun 17 '14 at 08:27
0

I found the solution. The vncserver was located in the Contents/MacOS directory, but it have to be in Contents/Resources

That's all :)

plettix
  • 133
  • 2
  • 9