Creating a HUD on top of another application with Cocoa

| | August 18, 2015

Is it possible to create a HUD with Cocoa on top of a window from another application? For example, if I were to create a Poker HUD, which would display information about opponents on top of a Poker Client window, how would I implement it in OS X (with Cocoa?).

For example how would I recreate the following Windows program (PokerTracker HUD: displays a HUD on top of PokerStars)?

For example the PokerTracker HUD

One Response to “Creating a HUD on top of another application with Cocoa”

  1. I’m not sure if this is what you’re asking, but I think the HUD elements would be controls or views within an NSWindow set up as an overlay. Here are some key steps to configure it:

    [myWindow setOpaque: NO];
    [myWindow setBackgroundColor: [NSColor clearColor]];
    [myWindow setLevel: NSStatusWindowLevel];

    And then you’d need to track which app is frontmost, so that your overlay would only be visible when the target app is in front. I think you could do this by finding the NSRunningApplication for the target app and then key-value-observing its active property.

Leave a Reply