0

If I have two windows for an app in the same desktop/workspace/space, then the move focus to next window shortcut moves focus between them. If the windows are in different desktops, focus is not moved. Is there a way to make a shortcut that switches to the next window for the app, even if its in a different desktop?

In Mission Control Preferences I have "When switching to an application, switch to a Space with open windows for the application" set. I also tried setting "Group windows by application"

seen on MacOS 10.14.3 Mojave (OSX)

Thanks

1

Under the conditions you've expressed, here's an alternative that I use when ` isn't a viable option.

Using the example AppleScript code below, saved as a .scpt file in Script Editor, and using FastScripts to assign a keyboard shortcut to it, it clicks the frontmost application's Dock Tile so it will switch between Desktops. For this particular script in FastScripts, I use keyboard shortcut ⌃⇧⌘D to trigger it.

tell application "System Events" to click UI element ¬
    ((get name of application processes whose frontmost is true) as text) ¬
        of list 1 of application process "Dock"

Or, if you do not want to use a third party app to trigger the .scpt file, the example AppleScript code can be used in an Automator Quick Action1, setting Workflow receives no input in any application and add a Run AppleScript action, adding the example AppleScript code where is says: (* Your script goes here *), then save the Quick Action.

You can then assign a keyboard shortcut in: System Preferences > Keyboard > Shortcuts > Services


Note that using either method may require accessibility privileges be granted.

Also keep in mind that when assigning global keyboard shortcuts, there is always the potential to conflict with an already assigned shortcut, so you may have to use a different one and or add error handling to the example AppleScript code


1 In versions of macOS prior to Mojave a Quick Action is called a Service.


Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the used to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.


I am not affiliated with the the developer, Red Sweater Software, of FastScripts... just a satisfied user.

  • Thanks, unfortunately the dock click just toggles between the 2 most recent windows for the app and doesn't cycle through all the windows. – wizangzing May 17 at 16:07

You must log in to answer this question.

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