kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.36k stars 128 forks source link

Is there way to open/activate closed main window of an app? #255

Closed varp closed 4 years ago

varp commented 4 years ago
varp commented 4 years ago

I'm also use Alfred on my Mac, and when I'm activating the app by Alfred the app with closed main window opens and activates. That's weird... Can the both apps (Alfred and Kasper) use different APIs?

kasper commented 4 years ago

@varp Hello! When you close the window, its instance is released and therefore the window does not exist anymore. You have to create a new window for the app by opening it.

varp commented 4 years ago

Thanks. now I use AppleScript to open an application's default window. The first, I just try to reopen app - reopenApp. In case of the Dash app and also many more it just did the trick. The second, for other case and the specific logic - AppleScript. I am really still confusing.... Why the underlying API that you use in Kasper dosen't offer API for opening a new window....

kasper commented 4 years ago

@varp Hi! You can open up a new window by doing the following:

App.launch('Mail', { focus: true });
varp commented 4 years ago

This not obvious. Anyway, thank you so much. Closing the issue. And, AppleScript has the bonus in it - it returns all Finder windows from all Spaces - and it was important for my case.

kasper commented 4 years ago

@varp Thanks for the feedback, I’ll see if I can improve this!