ui
ui copied to clipboard
Window to front
Is there some way to bring the window to the front programmatically?
What OS? What scenario?
It happens on OS X to me, I run the created executable from the command line. The window opens and centers as expected, but the focus doesnt switch to the application. The active application is still the terminal.
See https://github.com/andlabs/libui/pull/20#issuecomment-211381971
I understand it shouldn't be the default state, but is there another way to pass NSApp activateIgnoringOtherApps
or NSApplicationActivateAllWindows
?
Recently I found that some features of OS X, namely Dictation, only work if the program is run in a .app bundle, which will remove the need for this. I need to do some more investigation to see if this is actually the right way to go...
Those methods are for starting a separate program from within your own.
looking for an ez solution for this one. Maybe after each build I can just throw the binary into the right folder structure and rename .app?
Those methods are for starting a separate program from within your own.
indeed! I must have been half asleep. Aaaaand, now I remember why I wrote that. The point was, those NSWorkspace methods are the equivalent of activation. You can absolutely tell the workspace to activate you in that way. Then, it in turn goes through Launch Services, because, those methods directly wrap the long deprecated LS prefixed Launch Services functions that could do the same. By going through Launch Services via NSWorkspace, it is behaving much much more the way a user activating you app in the UI behaves. It removes the unfair contention of focus stealing, removes the unnatural behavior and allows for user interactions on the system to order focus and activations as normal. It might seem backward and roundabout but it works.