Show / hide application menu / icon in dock / windows cycling / ...

  • Hi all,

    I've got application (Mac Application Store, deployment target >= 10.8), which has LSUIElement set to YES in Info.plist. It's status bar application. I do open windows without menu in menu bar and app icon is not visible in dock, cycling, … Just what I need.

    But now, I've got one window, which is wizard/tour/... and I would like to show menu for this one window and I also would like to have it visible in cycling (cmd-tab windows switching).

    Tried to change activation policy and it does work partially. LSUIElement = 1 equals to NSApplicationActivationPolicyAccessory. According to the documentation, I can change it to NSApplicationActivationPolicyRegular to show menu and show app icon in cycling. But anyway, it's not possible to go back from NSApplicationActivationPolicyRegular to NSApplicationActivationPolicyAccessory. setActivationPolicy: always returns NO and it's correct according to the documentation: Currently, NSApplicationActivationPolicyNone and NSApplicationActivationPolicyAccessory may be changed to NSApplicationActivationPolicyRegular, but other modifications are not supported.

    Is there another way how can I achieve this behavior? LSUIElement = YES application with menu/app icon in dock/... for just one particular window? Other windows can't be opened in the same time and this is just the only visible window.

    Thanks,
    Robert
  • On May 27, 2013, at 6:30 AM, Robert Vojta wrote:

    > Tried to change activation policy and it does work partially. LSUIElement = 1 equals to NSApplicationActivationPolicyAccessory. According to the documentation, I can change it to NSApplicationActivationPolicyRegular to show menu and show app icon in cycling. But anyway, it's not possible to go back from NSApplicationActivationPolicyRegular to NSApplicationActivationPolicyAccessory. setActivationPolicy: always returns NO and it's correct according to the documentation: Currently, NSApplicationActivationPolicyNone and NSApplicationActivationPolicyAccessory may be changed to NSApplicationActivationPolicyRegular, but other modifications are not supported.

    That's what the docs say although, apparently, since Lion you can also set it to NSApplicationActivationPolicyProhibited.  See <http://www.cocoabuilder.com/archive/cocoa/318334-turning-app-into-backgroun
    d-app.html
    >, keeping in mind that Eric Schlegel is an Apple developer.

    That doesn't particularly help you, though.

    > Is there another way how can I achieve this behavior? LSUIElement = YES application with menu/app icon in dock/... for just one particular window? Other windows can't be opened in the same time and this is just the only visible window.

    No.  The usual recommendation is to launch a helper app, one which is not an LSUIElement, to handle the interaction.

    Regards,
    Ken
  • Ken, thanks for the reply. Prohibited is no way.

    Maybe you know how to solve following problem and there will be no need for switching activation policy or creating another helper.

    1. App creates new Wizard NSWindow
    2. Window is visible, user did go through several steps and now I do ask ACAccountStore for permission to access system Facebook account
    3. Over my wizard window, system dialog appears and asks user if he allows / disallows
    4. User clicks on any button, system dialog disappears and my window disappears as well (actually my window is below other apps windows)

    And now, because my app has LSUIElement set to YES, app is not listed in cycling, no menu, no dock icon and thus there's no way how to get back to my wizard window unless user moves these windows or clicks again on my status bar icon, because I know that wizard is still open and I move it to the front.

    One solution, which I don't like, is to set windowLevel to NSFloatingWindowLevel for example. Now, my wizard window is still visible, but it's not convenient to have this window still on top.

    I'm still thinking about it and it seems that helper is the only way unless I find some nice & clean solution.

    R.
  • On May 28, 2013, at 6:20 AM, Robert Vojta wrote:

    > Maybe you know how to solve following problem and there will be no need for switching activation policy or creating another helper.
    >
    > 1. App creates new Wizard NSWindow
    > 2. Window is visible, user did go through several steps and now I do ask ACAccountStore for permission to access system Facebook account
    > 3. Over my wizard window, system dialog appears and asks user if he allows / disallows
    > 4. User clicks on any button, system dialog disappears and my window disappears as well (actually my window is below other apps windows)
    >
    > And now, because my app has LSUIElement set to YES, app is not listed in cycling, no menu, no dock icon and thus there's no way how to get back to my wizard window unless user moves these windows or clicks again on my status bar icon, because I know that wizard is still open and I move it to the front.

    Can't you just activate your app (if it's been deactivated) and order your window to the front when the ACAccountStore request completes?

    Regards,
    Ken
  • On Tuesday, 28. May 2013 at 13:31, Ken Thomases wrote:

    > Can't you just activate your app (if it's been deactivated) and order your window to the front when the ACAccountStore request completes?

    Ouch, stupid me, yes, does work ;-) Thanks.
previous month may 2013 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