Discussion in 'Mac Programming' started by mbabauer, Sep 11, 2006.

  1. mbabauer macrumors regular

    Feb 14, 2006
    I am playing around with Cocoa, and read through a couple of books, but none of them show you how to add an app that runs in the Menubar (Task Tray???) like QuickSilver or Backlight does. Obviously it can be done, but how? A search in the Apple Developers docs for 'menubar' turns up a ton of references to Tk menus, but not really what I need.
  2. mbabauer thread starter macrumors regular

    Feb 14, 2006
    Ok, finally got some leads in the docs and Google. There are actually two places this can be done, as an NSMenuExtras or as a NSStatusItem.

    The problem is that apparently NSMenuExtras is a closed API, and NSStatusItem is not guaranteed to be there, as long menu items can overwrite status items if they need space.

    There are some workarounds, although I am not clear how they fully work, but they seem to be more like hacks than legit code.

    Anyone have any sample code that puts a Status Item up with no menu or window? I am trying to do something similar to QuickSilver (in layout, not functionality) where there is an icon on the right of the menu bar that does something when you click it.
  3. savar macrumors 68000


    Jun 6, 2003
    District of Columbia
    I had the same problem several years ago. Back then there were rumors that NSMenuExtras would be made public for 3rd party developers to use. Guesss that never happened.

    Using NSStatusItem isn't too bad. I don't have the code anymore, but I think I found it on
  4. Fairly macrumors regular

    Sep 24, 2006
    Cambridge UK
    That's cos you didn't get the one Cocoa book you need. By Yacktman.

Share This Page