Getting Mac OS X applications to close after last window closed
I know it's just a pet peeve, but I hate it that Mac OS X's Preview.app stays open when it has no windows open. Is there any way to make it close when its last window is closed?
Since I don't see any option inside Preview to make that happen, I imagine that the answer might be applicable to other programs that have similar … idiosyncrasies.
I realize that this is not outside the OS's interface guidelines. That is, I recognize that this isn't a bug that will be fixed. I'm wondering if there is some way to automatically close selected GUI applications that have no windows open.
Solution 1:
Try RedQuits:
RedQuits is there to help if you have ever tried to close an application with its red button and wondered why it is still open. With RedQuits, all programs now quit when there's only one window left for that program. If you want to quit and close all open windows of a program, just uncheck "Quit only when 1 window is left for that app." in the preferences.
Solution 2:
In short: No.
--Answer stops here. Everything following is just my attempt to explain why.
What you are experiencing is the Mac philosophy of how applications should behave. Those who are closed after the last window dissapears are not behaving to Mac Interface Guidelines (though there are a lot out there).
// Edit: This is not entirely correct, see posts below.
It has been that way since the very first Mac System (in 1984). I guess it'll stay with us for another 25 years to come. Maybe app devs will allow us to set that in the preferences.
Until then it helps getting used to Command-Q (the Apple key and q) to quit each and every app - and Command-W for just the active window.
Solution 3:
I wrote an AppleScript application to do this for you.
In brief, it checks what applications are open, gives you the option to whitelist apps to be excluded from auto-quit, then every 60 seconds, quits all applications (that it can, due to limitations).
To alter the whitelist while it's running, click the icon in the dock for the selection dialog to reappear.
To quit, right click the Dock icon and choose "Quit"
AppleScript source and Application: http://files.me.com/kioarthurdane/6kjl9k
Solution 4:
The automatic termination feature introduced in 10.7 partially addresses that for some applications.
If you open Preview, open at least one window in it, close all windows, and switch to another application, Preview is hidden from the Dock and application switcher. If you look at Activity Monitor, the process is still running and uses memory, but there might be some changes in how the process is managed.
The Mac App Programming Guide says that processes are actually terminated, so there might be something I'm missing.
- Automatic termination eliminates the need for users to quit an app. Instead, the system manages app termination transparently behind the scenes, terminating apps that are not in use to reclaim needed resources such as memory.
[...]
Automatic termination transfers the job of managing processes from the user to the system, which is better equipped to handle the job. Users do not need to manage processes manually anyway. All they really need is to run apps and have those apps available when they need them. Automatic termination makes that possible while ensuring that system performance is not adversely affected.