turning app into background app

  • Hi,

    I have an older project where I write to my own .plist to set LSUIElement to change my app from being hidden or non-hidden.  I know this is not recommended and I'm looking for a "newer" way to do this?  I only have a single app here not a helper app so that's why I'm trying to figure this out.  I did read that I could set my app to have LSUIElement - YES by default and then use TransformProcessType to unhide it since there is no way to do it in reverse.  But is this a good practice to do on a regular basis?  I would say that 10% of my users would like to run my app as a background app and the other 90% would like it the normal way.  What can you recommend?  Thanks,

    rc
  • On Jul 8, 2012, at 5:52 AM, "Rick C." <rickcorteza...> wrote:

    > I did read that I could set my app to have LSUIElement - YES by default and then use TransformProcessType to unhide it since there is no way to do it in reverse.

    Note that in 10.7 and later, you can use TransformProcessType to convert your app back into a background-only or UIElement app, as well.

    -eric
  • On Jul 9, 2012, at 1:33 PM, Eric Schlegel wrote:

    > On Jul 8, 2012, at 5:52 AM, "Rick C." <rickcorteza...> wrote:
    >
    >> I did read that I could set my app to have LSUIElement - YES by default and then use TransformProcessType to unhide it since there is no way to do it in reverse.
    >
    > Note that in 10.7 and later, you can use TransformProcessType to convert your app back into a background-only or UIElement app, as well.

    Fascinating.  Does this apply to -[NSApplication setActivationPolicy:] as well?

    Cheers,
    Ken
  • Thank you very much I overlooked this!

    rc

    On Jul 10, 2012, at 2:33 AM, Eric Schlegel wrote:

    >
    > On Jul 8, 2012, at 5:52 AM, "Rick C." <rickcorteza...> wrote:
    >
    >> I did read that I could set my app to have LSUIElement - YES by default and then use TransformProcessType to unhide it since there is no way to do it in reverse.
    >
    > Note that in 10.7 and later, you can use TransformProcessType to convert your app back into a background-only or UIElement app, as well.
    >
    > -eric
    >
  • On Jul 9, 2012, at 1:33 PM, Eric Schlegel wrote:

    > On Jul 8, 2012, at 5:52 AM, "Rick C." <rickcorteza...> wrote:
    >
    >> I did read that I could set my app to have LSUIElement - YES by default and then use TransformProcessType to unhide it since there is no way to do it in reverse.
    >
    > Note that in 10.7 and later, you can use TransformProcessType to convert your app back into a background-only or UIElement app, as well.
    >
    > -eric

    I notice that in the headers, the new constants are marked "functional in Mac OS X Barolo and later.” Was Barolo an early code-name for Lion, or does this refer to one of the various 10.7.x updates?

    Charles
  • On Jul 9, 2012, at 1:33 PM, Eric Schlegel wrote:

    > On Jul 8, 2012, at 5:52 AM, "Rick C." <rickcorteza...> wrote:
    >
    >> I did read that I could set my app to have LSUIElement - YES by default and then use TransformProcessType to unhide it since there is no way to do it in reverse.
    >
    > Note that in 10.7 and later, you can use TransformProcessType to convert your app back into a background-only or UIElement app, as well.
    >
    > -eric

    Also, I just tried this out, and it seems that it always converts the app into a background-only app, even if I specify to convert it to a UIElement app. If it has any windows open, they disappear and don’t come back until I convert it back to a foreground app, which doesn’t seem to be the correct behavior for LSUIElement.

    Charles
  • On Jul 9, 2012, at 5:58 PM, Charles Srstka wrote:

    > I notice that in the headers, the new constants are marked "functional in Mac OS X Barolo and later.” Was Barolo an early code-name for Lion

    Yes.

    > Also, I just tried this out, and it seems that it always converts the app into a background-only app, even if I specify to convert it to a UIElement app. If it has any windows open, they disappear and don’t come back until I convert it back to a foreground app, which doesn’t seem to be the correct behavior for LSUIElement.

    That's unfortunate, but not too surprising. This feature was added and primarily used for the Lion capability of turning a foreground app into a background-only app when the app is deactivated with no windows open. The convert-to-UIElement path probably hasn't been tested as well (if at all). Feel free to file a bug about your results.

    -eric
  • On Jul 9, 2012, at 11:55 AM, Ken Thomases <ken...> wrote:

    >> Note that in 10.7 and later, you can use TransformProcessType to convert your app back into a background-only or UIElement app, as well.
    >
    > Fascinating.  Does this apply to -[NSApplication setActivationPolicy:] as well?

    setActivationPolicy:NSApplicationActivationPolicyProhibited is supported in 10.7 to convert to a background-only app. NSApplicationActivationPolicyAccessory isn't supported.

    -eric
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today