Prevent switching workspaces when clicking on dock icon I am constantly running multiple applications on multiple workspaces. I want to remain on the same workspace, and only switch workspaces when I explicitly ask for it (e.g. with a magic mouse gesture).

Currently when I click on the app icon in the dock, osx switches to the next workspace that has a window of the active application.

I know there is an option in System Preferences -> Misson Control, called "When switching to an application, switch to a space with open windows for the application". What it does: When clicking on the icon of an inactive application, don't switch to a workspace that has the application window. But this option does not affect the behaviour of clicking on an active application.



The question: How do I prevent OSX from ever switching to another wokspace when clicking on an app icon in the dock, regardless of whether the app is active of inactive?
Open Terminal.app, then run the following commands.  

Change the default workspace preference:  


  defaults write com.apple.dock workspaces-auto-swoosh -bool NO  


Next, restart the Dock with this command:


  killall Dock


References:
How can I disable auto-switching desktops?
Disable Space switching on Command-Tab