# How to code a system menu bar item?



## michaelsanford (Sep 30, 2003)

I want to make a little, lightweight customizable application to back up my files to various media (my USB stick, FireWire drive, ftp folders, etc).

Looking through the PB default applicaiton types I don't see anything that looks like it would give me an icon in the SystemUIServer (or the menu bar to be less specific).

Do I have to construct my own .menu item from scratch?

Incidentally, I also have MenuMeters installed, but it doesn't behave the same way as the Apple menu extras (i.e., I can't command-drag it out of the menu bar, or move it along the menu bar)...

If anyone has any sample code, that would be the best! I can't find any GNU manu bar apps as of yet...

Thanks!


(PS: How appropriate this is my 1024th post  )


----------



## Arden (Sep 30, 2003)

Have you checked Apple's Developer Center?  They have lots of sample code.


----------



## Darkshadow (Sep 30, 2003)

That's because Apple pretty much banned us from making menu extras (the NSMenuExtra code that .menus use is part of a private framework) BUT they do allow us to use NSStatusItem.  The only thing about it is that you have to make an application rather than a .menu bundle, and as you mentioned above, you can't command drag it around.

Means you'll have to remember to start up that application (or just add it to your login items).

Here's a pretty good tutorial on NSStatusItems: Recent Tunes NSStatusItem.  It gives the basics pretty well (and it'll show ya how to use Applescript inside an app as well, which is pretty cool too).


----------



## Arden (Oct 1, 2003)

Email Aladdin and ask how they did it.

I wish Apple would stop trying to restrict us from modifying different portions of the OS.  Oh well, maybe when it's more fully settled.


----------



## Darkshadow (Oct 1, 2003)

In this case, mainly it's because menu extras run under the SystemUIServer process, and any third party ones can cause it to crash.  They don't want to have to bother with that.


----------



## michaelsanford (Oct 2, 2003)

Wow thanks guys, lots of great responses.

I'll take a closer look at ADC, but I'm not really fluent in Obj-C so making all sorts of constructs from scratch is going to take me a long time hehe.


----------

