[SOLVED] How to Switch Focus to a Different Specific Chrome Window (Not Just a Tab)?

Hey @August,

Easy?  Nyet, I'm afraid not.

Aside from window information/manipulation where I expect Peter depends upon the macOS window manager, I believe all of KM's Chrome functions depend upon AppleScript under the hood.

Google has some weird ideas about how they reference tabs by tab ID but the active tab by tab index – and this makes bringing a given tab to the front more difficult than it should be.

There ought to be a global active tab property in the application class, but there's not.

The available active tab property is local to the window class, so you've got to jump through some hoops to activate both the window and the tab.

But – the job is doable.

Here's a no-frills Go-To-Tab macro.

You get a smart pick-list that allows typing one or more strings to be searched against the list of tab names.

Go To Google Chrome Tab by Name v1.00.kmmacros (9.5 KB)

Personally I prefer the AppleScript dialog based method I use in this macro:

NOTE – the macro linked here is for Safari and is not directly translatable to Google Chrome – they have significantly different AppleScript dictionaries.

The search is not as good, as it only has type-select and not a true word search – but I find the font easier to read – and the dialog will expand up to screen-width if the contained text is large enough.

If I was going to use a macro like the Go-To-Tab macro above on a daily basis I'd probably have to break down and use a Custom HTML Prompt action, so I could tweak it more to my liking.

@DanThomas has made that especially easy:

MACRO: Spotlight Search Prompt

You really ought to scope out his other masterwork as well:

MACRO: [KMFAM] Favorite Actions and Macros

-Chris

1 Like