Search code examples
cocoacustom-viewalpha-transparencynsstatusitem

NSStatusItem with custom view, alpha value, and multiple displays


I have an app which has a NSStatusItem that uses a custom view. I apply an alpha value to the status item's view when a process in the app in inactive. This works fine, except on OS X 10.9 - 10.10 when multiple displays (monitors) are present. The system menu bar auto-applies an alpha value to itself when it is on an inactive display. On the inactive display, the custom view in my status item seems to completely disappear.

I am guessing that OS X auto-applying an alpha value to the menu bar on the inactive display is combining with the alpha value I am setting directly to the view and causing the view to have an overall alpha value of 0 or less.

Any ideas on how to handle this? Thanks in advance!


Solution

  • As far as I know, to display an inactive NSStatusItem you should use another image, that is the same as the one used when active, but with a grey color (and that image must have template = true).

    I guess that applying an alphaValue to the item works just because that is the way that the system uses when a second monitor is attached.