Make app not fully steal focus

This is an odd one that is difficult to describe, so I hope I can explain it well enough!

I’m creating an OSX app that has an icon in the top menu bar. You click the icon, the app is shown as a drop down menu that you interact with and then it closes when you move away or perform a particular action. The app is a little more complex than just a drop down menu, it has interactive elements like text fields and list boxes. A good example of the style would be Fantastical (http://flexibits.com/fantastical).

The issue I’m having is that I don’t want the app to completely steal focus from whatever app is currently being used. I can do this by making the app a global floating window, however this means that you can’t click and type inside any of the text boxes on my app. So what I need is it to ‘kind of’ take focus. An example of what I mean is if click on the Spotlight icon. You can type in the Spotlight search field, but if you look you can see that it hasn’t actually taken full focus from the last app, so when you close Spotlight you are returned to the last app you were using. Fantastical also does this and I want my app to do the same.

Making my app a normal document window will mean it opens behind the in focus app when clicking the menubar icon, so I have to force it to the front (using MBS), which also makes it steal focus, but when my app window closes the focus isn’t returned to the last app. If I make it a global floating window, it doesn’t steal focus, but then I can’t type in the text boxes on my app as the text appears within the in focus app.

A lot of menu bar items seem capable of performing this ‘half in focus’ trick, so I was wondering if it would also be possible in Xojo?

Add LSUIElement row and set it to “true” by editing the application’s Info.plist.

Hi Tuomo, thanks for the reply.

This gives me the same result as setting the window to a global floating window. It no longer steals focus, but it also won’t let me click within any of the text boxes within my app.

Any other ideas?