Switching apps: how to show just one window? 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. 

Thanks!
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.