Loyal Tingley
Loyal Tingley

Reputation: 900

Show NSWindow as dropdown from NSStatusItem?

How can I show an NSWindow when clicking on an NSStatusItem, such that it shows over other applications when appearing, but without causing them to lose active status?

I have seen MAAttachedWindow, and it is neat but it does not show on top of other applications unless its own application is active.

Upvotes: 3

Views: 1587

Answers (2)

6 1
6 1

Reputation: 1074

if you use MAAttachedWindow, you can set the winow level as NSStatusWindowLevel. Then it will show on top of other application.

Upvotes: 1

Francis McGrew
Francis McGrew

Reputation: 7272

I would check out this excellent tutorial and sample project: Cocoa Popup window in the Status bar

That example shows how to "attach" a window to a status bar item, but you could position the window wherever you want. Basically, if you define your app as a LSUIElement you can display floating utility windows despite your app never activating or showing a dock icon, and other apps still remain key.

Upvotes: 6

Related Questions