Problem with "Application is running" conditions

I'm seeing a weird behavior that I don't think I've seen before. My guess is it's a macOS problem but it's screwing up several of my KM macros. It's happened with both Things and Spotify—at different times they have both seemed to be half-running and half-not-running. In both cases:

— The application appears in the Dock (where I don't have it by default) with a dot next to it (usually the sign of a running application.
— The application doesn't appear in the system app switcher (the one built-in to macOS, which appears when I press Command-Tab).
— KM thinks the application is running, inasmuch as an "application is running" condition returns true.

Has anyone seen this? Any ideas?

I don’t have Spotify but I use Things.

With Things I also notice a strange behavior sometimes: Icon is in the Dock, marked as running, but when I click it, it takes like 5 to 10 seconds until the window appears – or it crashes in the process.

I think (not absolutely sure at the moment) that this happens only after Things

  • was not frontmost for a long time (sometimes I prefer not to see my ToDo list :wink: )
  • has been automatically launched at system reboot, because it was open before reboot.

I will pay more attention the next time it happens, especially if it disappears from the app switcher.

I have seen a few apps, notable 1Password, which instead of quitting converts itself from a foreground application to a background-only application.

So the application is still running, but is no longer a foreground application, so it does not show up in the Application Switcher, but is still technically a running application.

I don't know if Spotify and/or Things do the same sort of thing, but it would not surprise me.

That’s interesting, Peter. Can you think of a way to test for that condition within KM, e.g. by shell scripting?

Not offhand, no.

For anyone else who cares: You can use
ps -ax | grep [name of process]

although the grep command itself shows up in the results so you have to subtract 1.