MacOS – Quit the app after the last tab/window is closed

applicationsmacos

I find those black little dots under the applications are annoying, like this:
enter image description here

In fact, in the figure above, I have no Word docs open. In the case that I thought maybe I was working on something (which happens a lot), I will click the Word icon to find out which doc I was reading. However, it opens a new blank Word, which I find annoying.

The extreme way of disabling all the dots is not a good idea. I need to be aware of which apps I am working on.

One reason that I like (Mac)Vim very much because it gives an option like this:

enter image description here

But not all apps give this option, it seems.

So, I am wondering if there is any solution for these annoying dots.


After some search, I found this, which was in 2012. So no updates?

Edited:
By the way, I don't like +Q to close the app directly, because it may close other running windows/tabs accidentally.

Best Answer

Here's an incomplete solution: Use Script Editor app, and in its preferences, get its icon visible in the Menu bar. Write a script that checks all the apps' open windows and closes them if there is none, neither minimised or hidden or in full screen or split. Whitelist some apps, like Spotify. Put the script in /Library/Scripts/ so that it is accessible directly under this menu. Use this periodically yourself when you feel to do so. If you use it rarely, better discard it.

enter image description here

In addition to that, keep these preferences as suggested:

  • In System Preferences → Mission Control, Tick "When switching to an app, switch to a space with open windows for the application"

  • In General, untick "Close windows when quitting an app" to prevent accidental losses.

  • In every app you come across, tick "ask before quitting". In "General", Tick "Ask to keep changes when closing documents"

Now gimme the script!!

Search the site for such questions, put together a script, ask a new question/ update this.