Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Mac: "Launching" app when it's already open doesn't put it in foreground #2616
On macOS, launching applications when they are already open puts them in the foreground. For instance:
This also works with apps built with py2app:
But it doesn't work with apps built with PyInstaller. Proceeding from the above command line:
I am encountering exactly the same problem with a PyQt5 app I'm working on. So the problem is not specific to PyObjC.
Without knowing PyInstaller well enough, I suspect it is because of the way it launches. When starting an app built with PyInstaller, it spawns a new process:
I am guessing the parent process (19285) sets up the environment, and the child process does the actual GUI display. I suspect that macOS only "sees" the parent process, thinks it doesn't have a GUI and is thus unable to "switch to it".
Or, it could be caused by the parent process "Not Responding" in the screenshot.
You could try changing it to