4

I'm trying to look for tutorials on getting my AIR application to OSX's menubar when minimized. However, when I try to search for it, I end up getting examples on doing it for the system tray on Windows and the Dock on macs. I don't want the app to stay on the dock when the window is not visible. I want it to minimize to the menubar instead. Can anyone give me a hand? I'm not even sure where to start.

EDIT: I don't want to learn about working with the OS X dock (on this post at least). I'm interested in working with the menubar. (See image below.) enter image description here

Propeller
  • 2,465
  • 6
  • 35
  • 49

2 Answers2

2

Looks like you need to distribute your app as .dmg and include a native process. It should be possible though, but you need to write the MacOS bit yourself. Check this out: http://www.adobe.com/devnet/air/flex/quickstart/articles/interacting_with_native_process.html

This is actually a pretty good tutorial on how to create a status bar icon in OSX: http://www.sonsothunder.com/devres/livecode/tutorials/StatusMenu.html

Nuthinking
  • 1,211
  • 2
  • 13
  • 32
0

I don't think menu bar icons (os system tray icons, in Windows lexicon) are supported for OS X in AIR. You can test it running this snippet in your Mac:

if(NativeApplication.supportsDockIcon){
    trace( "Dock icon IS supported" );
}else{
    trace( "Dock icon IS NOT supported :(" ); 
}

if (NativeApplication.supportsSystemTrayIcon){
    trace( "System Tray icon IS supported" );
}else{
    trace( "System Tray icon IS NOT supported :(" ); 
}

As read in Adobe's support site:

"Applications icons are supported on both the Mac OS X and Windows operating systems, although the conventions for using these icons on each system are a bit different. On Mac OS X, the application icon is the dock icon and is represented by the AIR DockIcon object. On Windows, the application icon is the system tray icon and is represented by the AIR SystemTrayIcon object. The icon object for your application is created automatically. The object type is determined according to the operating system on which the instance of your application is running."

More info and example code here: http://www.adobe.com/devnet/air/flex/quickstart/articles/stopwatch_dock_system_tray.html

protozoo
  • 560
  • 6
  • 16
  • Thanks but I believe you are referring to the dock icon and not the menubar which is the whole point of my question. – Propeller Mar 27 '12 at 16:29
  • Sorry, I was trying to say that, in AIR, menu bar icons are not supported for OS X. @lost's suggestion regarding Native Extensions seems like a good path to investigate, if you're able to deal with the Objective-C part (which I am not). – protozoo Mar 27 '12 at 20:41
  • Hasn't anyone come up with a sort-of wrapper to hack around this limitation? Something that's easily customizable? – Propeller Mar 28 '12 at 02:13