Switching Safari Windows using Window Menu item

So I have a mixture of Safari tabs and windows across several desktops. Would like to be able to command-` to move between Safari windows like you can in many apps.

Window Switcher works…except if the windows are in different desktops–then they aren’t found.

You can switch to windows in other desktops by using Safari’s next tab/previous tab which will bring up windows from another desktop.

Unfortunately, if I have multiple tabs (often pinned) the default next tab function often results in moving through the pinned tabs before getting to the other Safari window.

Safari does provide a Window menu item but I’m not sure how to best use a KM macro to move through it, whether down or up, and what to do when I reach the end.

Suggestions would be most welcome.

Hey James,

Since Apple doesn’t have a public API for Spaces, Keyboard Maestro’s ability to work with them is limited.

See if my AppleScript pick-list works in your context:

Safari » Switch Tabs-Windows Using Pick-List

If it does then there are some possibilities.

-Chris

Thanks! I’ll take a closer look later this weekend when I have some time.

But on first unmodified run I’m getting error:

“Safari got an error: Can’t make missing value into type document. Num: -1700”

But looks like it gets at the kind of functionality I’m looking for and could allow me to have just windows if that’s where I want to go.

Regards,

James R. Ehrler
jteammn@gmail.com

OK. The error was in the line:

tell (every window where its document is not missing value)

If I change it to just every window it works great...but...

...pinned tabs propagate across all the windows making it hard to find the actual unique tabs. But it is soooooo close!

Anyway to modify the script to only have the pinned/repeated tabs listed in the first window?

You can see what it looks like here:

Hey James,

Ah, that line was to work around a bug in Safari that Apple “fixed” sometime since Sierra came out. I'll have to post a fix to the original macro.

There's no way to detect pinned tabs without UI-Scripting, but it can be done.

What I'm inclined to do is to make pinned tabs appear at the top of the pick-list independent of any window, since they appear in ALL windows.

I think that'll be the easiest approach, although I'll have to tinker and think about it.

-Chris

Thanks for the reply. Since the pinned tabs all have the exact same URL and Title I wonder if duplicates can just be dumped?

Regards,

James R. Ehrler
jteammn@gmail.com

Hey James,

Perhaps I wasn't clear.

Pinned tabs would ONLY appear at the very top of the pick list.

-Chris