Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my iPhone, until iOS 6, anytime music is playing a play symbol appears (and disappears when no music is playing).

How can I achieve a similar effect in the menu bar of OSX Mountain Lion?

share|improve this question
Maybe a simple Cocoa App ? – Matthieu Riegler Jan 13 '13 at 1:14
@MatthieuRiegler, That's what I'm thinking. Hopefully something lightweight that doesn't do much/if any more then the play indicator. – bassplayer7 Jan 13 '13 at 1:28
For a cocoa app. It's less than 20 lines. I'll post an sample code – Matthieu Riegler Jan 13 '13 at 2:07
up vote 5 down vote accepted

Here is sample code for doing this in Cocoa (you can paste it in a new XCode project and build it) :

AppDelegate.h :

    NSStatusItem* statusItem;

AppDelegate.m :

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    [[NSDistributedNotificationCenter defaultCenter] addObserver:self
                                                          object:nil]; //registering for notifications from iTunes

    [NSApp setActivationPolicy:NSApplicationActivationPolicyProhibited]; //No icon in the dock, menubar only

    statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; // For the icon in the status bar

- (void) iTunesNotification:(NSNotification *)note {
    NSDictionary *information = [note userInfo];
    NSString* state = [information objectForKey:@"Player State"];

    if([state isEqualToString:@"Paused"]) {
        //hiding the indicator
        [statusItem setTitle:@""];
    } else if ([state isEqualToString:@"Playing"]) {
        //showing the indicator
        [statusItem setTitle:@"▶"];

The only flaw i could see in this sample is i'm using a character for the play icon and not a image. It could be a problem when the encoding messes something up.

share|improve this answer
Wow. This is terrific! Thank you very much for writing this up. I put it into XCode, packaged it as an app, and am using it as of writing. I even set it to start automatically when I log in. Does exactly what I want. Thanks. Truly awesome! – bassplayer7 Jan 13 '13 at 3:27

You could look at some of the menu bar apps that control iTunes for you. Some of those may have a nice interface for that. Here are a few

share|improve this answer
Bytecontroller is a good lightweight menu bar app – Kyle Cronin Jan 13 '13 at 2:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.