I've noticed one thing that annoys me about switching apps using the dock - if I have say, 5 different PDFs and 5 Firefox windows open, sometimes I'd like to switch back and forth between one pdf and one Firefox window. If I click the app icons on the dock, it brings all the windows for that app forward. Is there a way to force it to only bring the most recently active window forward? I've developed workarounds of course, but it'd be nice to have this.

I'm using Mavericks, if it makes a difference.


3 Answers 3


There's dreadfully few tweaks that can be applied to Dock, and none of the ones I know can modify the behavior of a single click on an app icon. What I would do in this situation is to assign a special gesture, say a four-finger click, to an applescript. The applescript will perform the task you want, which, in this case, is to bring up only the current window of the app under cursor.

To do this, you don't know need to know how to write a script - the script is here. You however need to know how to create custom gestures, enable Accessibility, etc. The best way to do this is the app BetterTouchTool.

tell application "System Events" to tell application process "Dock" to tell list 1
    set targetDockIcon to first UI element whose value of attribute "AXSubrole" ¬
    is not "AXSeparatorDockItem" and its value of attribute "AXSelected" is true
    tell targetDockIcon to perform action "AXShowMenu"
    tell (first menu item whose value of attribute "AXMenuItemMarkChar" is "✓") of ¬
    menu 1 of targetDockIcon to perform action "AXPress"
end tell

This script essentially find the app icon under cursor, right-click it for you, and click the window item with a check mark to its left. You will see the contextual menu flash for a brief second.


This script is tested on Yosemite.

  • This works brilliantly!
    – icurays1
    Commented May 17, 2015 at 15:25

If you click on the Dock representation of the application, it will do exactly that: Activate the application.

This means (tested on Yosemite with TextEdit and Mail):

  • if the application is not active
    • it will be launched/started.
  • if the application is active
    • all non-minimized windows will be presented to you in the foreground
    • and only have minimized windows, the window you opened first will be shown, leaving all other minimized windows in the Dock.
    • [Mail] if the main window is closed and you minimized a message reader or editor, the main window will be shown, leaving the message reader/editor minimized in the Dock

An answer to your question may be a third-party product, namely HyperDock. It's not free, but as of this writing tagged at EUR 6.95 still reasonably priced and you can test it free for 15 days.

After having it installed, it shows available windows above the Dock's application's icon when hovering over it with the mouse similar to Windows Aero. Clicking a window instead of the Dock item will bring this window to the front only.


CMD+tab does that too, switches between two most recent windows.

  • This has the same problem as clicking on the dock - it brings up all active windows (at least for me).
    – icurays1
    Commented May 17, 2015 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .