Floating app without focus (OSX)

Hi all,

I’m developing an app that will be used for a performance where the desktop will be screenshared. I need to keep my app in front of all other windows on the screen, but not steal focus from other windows. In other words, the app will always be on the screen while the performer is using other apps at the same time.

I have done some searching around for this but mostly come up empty handed.

I found that something like this will not work because you cannot mess with other apps other than moving their position around while the app is running. It does keep it in front, but it is really aggressive about not letting other apps do anything.

void BringAppToFront() {
[NSApp activateIgnoringOtherApps:YES ];

I thought that I would be able to use some combination of these, but it doesn’t seem to have any effect. I’m not sure if I’m implementing this incorrectly or what…

void BringAppToFront() {
    NSWindow* myWindow = nil;
    [myWindow setLevel:NSFloatingWindowLevel];
    [myWindow orderFrontRegardless];
    [myWindow orderFront: YES];

Any ideas or suggestions? I didn’t see anything that was already built in, I assume this kind of thing is platform specific.

I’ve also seen this piece of shareware called afloat that supposedly lets you do this, but have not had any luck getting it working.

Thanks for your help!

go inside your


and declare our function:

void ofEnableFloating(bool isEnabled);

then go to


and write our implementation:

void ofEnableFloating(bool isEnabled){
NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
NSString *bundleName = [NSString stringWithFormat:@"%@", [info objectForKey:@“CFBundleExecutable”]];
string standardAppName = [bundleName UTF8String];
for(NSWindow * myOFwindow in [NSApp windows])
if([myOFwindow.miniwindowTitle isEqual: [NSString stringWithCString:standardAppName.c_str()]]){
[myOFwindow setLevel:kCGFloatingWindowLevel];
[myOFwindow setLevel:NSNormalWindowLevel];



then inside your testApp::setup call


and that’s about it.

to disable call:


Thanks igiso! This works great. Unfortunately when I compile for release it seems to hit a snag. I’m getting a linker error with unidentified symbols.

Undefined symbols for architecture i386:
  "ofEnableFloating(bool)", referenced from:
      testApp::setup() in testApp.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any ideas?

EDIT: Nevermind, I just recompiled oF and now it’s working perfectly!

it can be done in windows as well, let me know if you need it