Programming for Mission Control

Before I buy the book, I would like to know: does it cover how to integrate an app with Mission Control?

In the simplest form, there are apps like Terminal and TextEdit where, if you have to reboot, open windows are restored to their original Mission Control Desktop location. While other apps (e.g., Stickie) restores all open windows to Desktop 1.

Does this book cover that difference?

Hi,

The book does not cover Mission Control at all. The behaviour you are discussing is a system setting and not app-specific. If you right-click on an app in the Dock, you can choose whether it appears in all desktops, the current one or a specific one.

1 Like

Thanks for getting back to me.

I’ve explored that thoroughly and those settings do not affect the reboot behavior, they just affect the live app windows. If I choose “All Windows” for an app, then when I change Desktops, the app is still there, the window or windows follow me from Desktop to Desktop. If I choose “This Desktop”, then all instances of the app will appear in the same Desktop.

Neither of those choices lets me have multiple projects, each with their own Desktop containing their own browser windows, Finder windows, text documents, spreadsheets, etc. So I have all my apps assigned to “None” so they will appear in whichever Desktop I open them and stay where I put them — except that the behavior if the system reboots varies from app to app, and restoring app windows to the various project Desktops can be time consuming and aggravating. That’s what I’m trying to learn how to influence.

Do you have a “go-to” expert on Mission Control that you might refer me to?

Thanks.

I do not know of any experts on Mission Control but I suggest you ask on the Kodeco Discord or in the Apple developer forums to see if anyone has any suggestions.

In System Settings - Desktop & Dock, there is a switch near the bottom labelled “Group windows by application”. If that switch is off, then you might be able to achieve what you’re looking for.

Yes, I keep that off. Basic window management under Mission Control I have figured out pretty well, from the user side. I’m trying to find out how to manage it from the app side.

There’s more that I want to be able to do, like programmatically move a window of my app( not necessarily any app) between desktops. But first, I’m trying to figure out the reboot behavior, once the app windows exist in various desktops.

Different Apple-provided apps have different behavior. Terminal and TextEdit I consider “well behaved”. If something hangs, like Chrome has too many open tabs or whatever, if I’m forced to reboot to clear a problem, both Terminal and TextEdit will reopen all their open windows in their original Desktops. But Stickies opens all its windows on the first Desktop. So I consider it poorly behaved. I would like to ensure that my own app is well behaved. Where do I start?

Thanks.

Stickies doesn’t use standard windows. The “well behaved” apps you mention do. So I would expect any app that uses the basic window pattern to behave as you wish.

But I don’t know for sure so can only suggest that you build a standard app and test it.

That’s what I’m working on, a simple app. So far I’ve done the Kodeco “Hello World” app tutorial. I haven’t figured out how to get that to create multiple windows. If I get the behavior that I want automatically, as you suggest might be the case, then that’s GREAT!

I’ve been trying to learn both what makes an app work and what makes an app scriptable with AppleScript by following your tutorial at “Making A Mac App Scriptable Tutorial”. I have questions, many of which may be version issues because I’m doing this on Catalina with Xcode 11.3. I haven’t figured out to get that one to make multiple windows either. Unfortunately the discussion thread in this forum about that tutorial got closed in 2017. Is there another place where I might ask questions about that tutorial or find other beginning tutorials? So far “Making a Mac App Scriptable Tutorial” ios the best I’ve found so far on the AppleScript side of things.

Thanks for any pointers you can offer.

Making multiple windows is difficult in an AppKit app unless you’re using a document-based app. This might be the best test app to try as it should operate much like TextEdit and would allow you to check out the Mission Control behaviour.

AppleScript hasn’t changed much over the years, so any documentation or articles you can find should still be reasonably relevant, even if they are quite old. It’s not a topic I have visited for years, so I don’t think I can be of any assistance here.

Thanks. Yes, TextEdit behaves very much like I want my app to, as far as maintaining window positions in Mission Control Desktops is concerned.

You used TextEdit as an example app in your “Making a Mac App Scriptable Tutorial” to illustrate the kinds of app control that AppleScript could provide, so that’s another way that TextEdit provides features that I’m trying to build. Maybe someone has done an opensource clone of TextEdit that I could strip down to just the features I need, but that could end up being just as hard as building it up.

Thanks