Re: Status bar item icon is always black
Re: Status bar item icon is always black
- Subject: Re: Status bar item icon is always black
- From: Gabriel Zachmann via Cocoa-dev <email@hidden>
- Date: Thu, 18 Jun 2020 11:06:25 +0200
Thanks a lot for your response.
For further info: this is what I have in Xcode:
https://owncloud.informatik.uni-bremen.de/index.php/s/T9SrFWNTxRbW83S
> Yeah, the isTemplate definitely shouldn't be set, that would cause that
> issue, I'd have expected setting that to false to fix your issue.
Also, when I look at
/tmp/Debug/Launcher.app/Contents/Resources/AppIcon.icns
the images are there (I can see them in Preview).
>
> I also think there was a feature where NSImage would automatically set the
> template flag when an image's name ended in "Template" or something like
> that. You might want to search for that unless you're really using an image
> named "AppIcon".
When I do this, for instance,
let itemImage = NSImage(named: "icon_16x16")
then there is nothing in the status bar.
The status bar app launches, but you can't see it (you can still click on it,
and it is working.)
> I just checked, and Flexibits' Fantastical still can use a colored icon, so
> there must be a way to make it work.
Even with B/W images, like the one I took from the tutorial
https://www.raywenderlich.com/450-menus-and-popovers-in-menu-bar-apps-for-macos
does not work.
>
> Is your status bar item a menu, or does it behave like a button? Fantastical
> does the latter, so maybe if you ask for a menu, you get some default "menu
> title" themeing?
If I understand your question correctly, the, yes, my status bar app is a menu,
because my code does this:
func applicationDidFinishLaunching(_ aNotification: Notification)
{
let statusBar = NSStatusBar.system
statusBarItem_ = statusBar.statusItem( withLength:
NSStatusItem.squareLength )
// statusBarItem_.button?.title = "AAL"
let itemImage = NSImage(named: "AppIcon")
itemImage?.isTemplate = false
statusBarItem_.button?.image = itemImage
let statusBarMenu = NSMenu( title: "AAL Menu" )
statusBarItem_.menu = statusBarMenu
statusBarMenu.addItem( withTitle: "Launch app Now", action:
#selector(AppDelegate.launchApp), keyEquivalent: "a" )
prefs_popover_ = NSPopover()
prefs_popover_.contentViewController =
PreferencesController.freshController()
statusBarMenu.addItem( withTitle: "Preferences", action:
#selector(AppDelegate.togglePrefsPopover), keyEquivalent: "," )
statusBarMenu.addItem( withTitle: "Quit", action:
#selector(AppDelegate.quit), keyEquivalent: "q" )
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden