[Xquartz-dev] LSBackgroundOnly at runtime

Peter O'Gorman peter at pogma.com
Tue Dec 4 18:26:16 PST 2007

Jeremy Huddleston wrote:
> So, I don't have much experience with launch-services, open-step, or
> cocoa... so I'm going to be needing some crutches for a while...
> I think I figured out what I need to do to eliminate the second dock
> icon.  I need to manage the foreground/background-ness of the
> application such that the launcher behaves as if LSBackgroundOnly=true
> and the server behaves as if LSBackgroundOnly=false.  How does one go
> about changing this at runtime to push a background app into the
> foreground or visa-versa?  It looks like NSApplication.hide() isn't
> right... that just causes the windows to hide, not push the app into the
> background... any help?

Pretty sure that Ben posted code to do that:

+  ProcessSerialNumber psn = { 0, kCurrentProcess };
+  fprintf(stderr, "Calling TransformProcessType\n");
+  TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+  SetFrontProcess(&psn);

So, I guess you'd need to look at the docs for TransformProcessType().

Peter O'Gorman

More information about the Xquartz-dev mailing list