![]() ![]() As it stands I don't know what to do next. How can it stay running after spawning the new instance?Īny hypothesis, steps to reproduce, etc are welcome. So even in a weird scenario, the app would quickly spawn and die, spawn and die, etc. The next line after open -n is to quit the current app. I can't picture how the code would result in 3 instances though. I guess something went wrong in your case. I didn't want to add a supervisor process that handles the restart because it's way more complexity to handle, so I used this open -n approach. I've spent a bunch of time looking online at how other people restart their app, and it's surprisingly a very complex problem. The code used to be just open + quit, and I thought it could lead to some data-races were the launch would happen while the app is still open, and trigger the preferences panel instead. The idea is that for a safer restart, it's better to first start a new instance, then quit the current one. That restart code use macOS open -n tool. The goal is to restart, run the launch sequence, realize the permission is missing, and show the user the window explaining that the permission is required to work. Oh, I found another edge-case: if you remove a required permission like Accessibility Permission in System Preferences, AltTab notices it, and restarts itself. Furthermore, on your ps output, we see that it's the same location/binary. Each would add their own login item, and multiple would thus launch after login.Īll these edge-cases have been handled. There was also a potential issue where someone could have various versions of AltTab that they downloaded to test them at some point. I made sure there that there can't be multiple AltTab. There was also an issue in the past where AltTab would start as a login item right after the user logs in their session. This way there is still a UX to open the preferences window. This is for people who hide the menubar icon.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |