I like to keep my dock tidy with almost only the applications I'm currently using shown. As such, I tend to completely quit out of apps so that they don't clutter my dock. However, there are apps which would be advantageous to allow to update in the background (e.g. mail). Is there a way to allow an app to remain open, but hide the icon when there are no open windows? I've seen ways to completely hide the icon at all times, but I would prefer that the icon was there when there are active windows open. Any clean way of doing this? Thank you much.
So I found this to be closest to what you want.
you can enable a ‘single application’ mode by entering the following command in Terminal:
defaults write com.apple.dock single-app -bool true
You must then enter this command in order to see the changes:
This mode allows for only 1 application to be shown at one time.