"Quit & Relaunch Finder" Action switches Desktop in Spaces

Hello,
Don't know if this is a bug in KM or just a peculiar behaviour in macOS, but I can reproduce this in multiple macros on macOS Monterey.

  1. Enable "Spaces" and set up 3 virtual desktops.
  2. Create a "Quit & Relaunch" action and choose Finder.
  3. Export the macro as a trigger file and place it on the Desktop.
  4. Open any application on Desktop 1.
  5. Switch to Desktop 2.
  6. Make a sure no other application is open in any of Desktop 2 or 3 and execute the trigger file.
  7. Observe that it will switch to Desktop 1 while executing the macro.
  8. Close the application in Desktop 1 and move to Desktop 3 and open any application.
  9. Move to Desktop 2 and execute the trigger file again.
  10. Observe that it will switch to Desktop 3 while executing the macro.
  11. Keep the application open on Desktop 3 and move to Desktop 2.
  12. Open any application on Desktop 2 and then execute the trigger file.
  13. Observe that it will not switch to Desktop 3.

So, it seems, if this particular action is executed without any application open on the current desktop, it will switch desktop before executing this. This does not seem to be the case when running Quit & Relaunch on a regular application such as Chrome.

I have multiple spaces, where one of them is a dev environment opened by KM, and it's highly annoying when it switches to the wrong spaces and opens a million windows' :slight_smile: Workaround is to open one of the other applications in the macro before executing the Finder part. Still, wanted to report this since I'm curious what could be the issue.

You're killing the Finder. It's going to be totally up to the OS what happens with respect to Spaces when you pull the rug out from underneath them!

Hello Andreas (@snattack):wave:

Assume you have Pages open on Space 3 of 16 possible Spaces in total and you have 8 of them.

Then after you've switched to Finder on Space 8 something strange happens and you have to restart the Finder. If I’m not mistaken the Mac switches back to the Space where the Last used Window of the Last used Application is open.

Based on this Scenario the Window is from Pages on Space 3 that will come to front.

Also one thing it can sometimes vary depending on what happened before Finder had to be killed and restarted that after a restart all your windows (when there really will be all reappear) may be opened on the current Space you are.

Thanks to Keyboard Maestro you have a chance to save your windows at the time you open them and you can make usage of this Application‘s power to check and/or restore everything back before you’ve killed the Finder.

Hope you’ve now a better understanding on this subject.

If you need Help building the Macros - on this forum are many good examples of a starting point and a lot of people you can ask for help.

I hope you’ve found that useful

Have a nice day and greetings from Germany :de:

Tobias