I'm a regular Spaces user and for the longest time I've been annoyed – very annoyed – by the fact that, when clicking on the Safari icon in the Dock from a Space where there are no browser windows open, either the Space is swapped with a different one where there's a Safari window open (if I have the "When switching application, jump to a Space with application windows open" setting enabled in System Preferences > Mission Control), or Safari activates, but with no window until I hit CMD+N (if that setting is off).
In the past I made Applescript-compiled apps to hack around this behavior, but they were complicated and not entirely reliable, so I kept living with this major frustration.
Today, the rug was swept under my feet for the last time, as I've figured I could put together something in Keyboard Maestro, and less than 5 minutes later I had a simple and so far reliable solution:
This is working well for me with the "When switching application, jump to a Space with application windows open" setting disabled... so I thought I'd share because maybe I can help someone else's blood pressure to stay within proper limits
I'm also a regular user of Mission Control Desktop Spaces and have been using the same action, but within a macro that I launch via Hot Key or Conflict Palette. When I open Safari via these two Keyboard Maestro triggers, I similarly force Safari to open a new window in the active space. (I have similar macros for the other browsers I use.)
Contrastingly, I've enabledWhen switching application, jump to a Space with application windows openenabled. That way when I launch Safari using standard methods (Spotlight, Dock, LaunchBar, etc.) the space automatically changes to the one that includes the most recently opened Safari window. I could see how this might be aggravating for some, but I personally like the flexibility that this affords.
@cdf1982, have you been similarly annoyed by the Finder. If so, you might like this macro subroutine: