Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i to make a window(osx) always hover on top of screen

i trying to make a osx application that just have one window and it will always on the top of screen. anyone knows how to achieve it? thanks.

like image 681
xhan Avatar asked Jul 19 '10 03:07

xhan


People also ask

How do I permanently make the window on top on my Mac?

With the toolbar of one app, hover over the green window button. You'll see a pop-up asking you to choose a tile format. Once you choose one, it will be replicated within your Spaces.

How do you make a floating window on a Mac?

If you want Tot's window to float above other windows on the Mac desktop, use the "Display as Floating Window" item in the Window menu. Note that the Window menu is only visible when you're using Tot with a Dock icon. You'll need to turn off the menu bar icon temporarily to change it.

How do you hover on a Mac?

Move the pointer over an item on the screen, then press the activation modifier (by default, the Command key) to display the Hover Text window. If you set the option to be able to lock the window, quickly press the modifier key three times to keep the Hover Text window on the screen.

How do I get my apps to stay on top?

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.


2 Answers

You can change the window's windowLevel (via -setLevel:) to NSFloatingWindowLevel.

[window setLevel:NSFloatingWindowLevel]; 

Documentation is here: Window_Levels

like image 92
Alan Rogers Avatar answered Sep 21 '22 05:09

Alan Rogers


By "on the top", do you mean you do not want your window to be obscured, even if a different app is active? In that case, one way is to start with the NSPanel template in Interface Builder, check the "Utility" option, and uncheck "Hide on Deactivate".

like image 40
JWWalker Avatar answered Sep 19 '22 05:09

JWWalker