Quit the app after the last tab/window is closed

Solution 1:

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.