I have an app which must always stay on top of other applications. I'm currently using the setLevel property for the main window to keep it on top of other desktop applications.
I'm trying to fix my app so it can also stay on top of full-screen apps in Lion. Any ideas on how this can be done?
The Application delegate looks like this:
#import "alwaysOnTopAppDelegate.h"
@implementation alwaysOnTopAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[window setLevel:NSFloatingWindowLevel];
}
@end
To make the active window always on top, press Ctrl + Spacebar (or the keyboard shortcut you assigned). Press the keyboard shortcut again to disable “always on top” for the active window. For script options, right-click on the AutoHotkey icon in the system tray.
In order to pin a window, right-click on the icon in your tray again and enter Pin Mode. Your cursor will change to a pin – click on the title bar of the window you want to always keep on top, and a pin will appear on that bar. It'll be the color you set in the options menu earlier.
Just press CTRL + SPACE on whatever window you want to stay on top.
Select the window you want to keep on top and press “Ctrl + Space” simultaneously.
Found the answer: The app delegate should look like this:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[window setLevel:kCGMainMenuWindowLevel-1];
[window setCollectionBehavior:NSWindowCollectionBehaviorStationary|NSWindowCollectionBehaviorCanJoinAllSpaces|NSWindowCollectionBehaviorFullScreenAuxiliary];
}
The way that Yoink works is simple: Just set "Application is Agent (UIElement)" to YES in the Info.plist for your application. It will mean it doesn't show in the dock etc. but that's probably fine for an auxiliary window (well, it was for me!). It probably makes sense to provide a menu bar item in this case so the user can stop the application easily.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With