Let's say I have Safari active and I want to cycle between its open windows by pressing Safari's dock icon (instead of pressing cmd+>).
Is it possible to accomplish this somehow?
|
|
|
There's no code in Dock.app to do this. command+` is the normal way to cycle through an application's open windows. If you want to cycle by clicking a dock icon, you could write an AppleScript to hit that keystroke and put that in the dock right next to Safari.
Put the above into AppleScript Editor, and save it as an application. It won't work unless we prevent it from stealing focus, which can be accomplished by right-clicking the app bundle and showing package contents, open Contents/Info.plist, and then add the LSBackgroundOnly key (Application is background only) with a boolean value of 1. Add it to the dock and click it to execute that keystroke. It'll work for any application. I find it a bit strange that you would think this is necessary or possible completely out of the blue. Is there something bigger that you're trying to accomplish with this? |
|||
|
|
You can right click on the dock icon and the menu will list all of the applications open windows. |
|||
|
|
"Cmd >" ? Why not use "Cmd `" (backtick, the key above the Tab), which is the standard one to cycle between windows for any app? If not, then you want to "bind" to something that you can single-click? Edit: an easy built-in mouse-only approach is to set a Hot Corner in the System Preferences to show all Application Windows, then you can click on the one you want. But that doesn't "cycle". |
||||
|
|
|
The wanted behaviour can be achieved by replacing the Safari's icon in the dock with the following AppleScript (following NReilingh's example) saved as an Application:
That will focus Safari and cycle through its active windows. If Safari is not open, it will be opened on the first time, so this works also like the normal Safari icon. To complete things you need to edit the script's properties - right click the script app in Finder and select Show Package Contents, then open Info.plist in Contents.
Now you should have an icon in dock that looks like Safari's but with added window cycling with subsequent clicks - if you named the script as Safari, nobody should notice any difference with original. |
|||||
|