Google Chrome – How to Bring an Existing GMail Tab to the Front

In Google chrome. I would like to go from one website or whatever to googlemail inbox with a shortcut.
How to jump between without to start the program every time, but just open them (go to the one), when they are in background?

1 Like

1: activate / start all the programs you currently use
2: create global short cuts eg Control + CMD + ? where ? = your app eg Finder Safari FirefoX etc

and use

Hi jonathonl!

I have set it up as you say, but no results.
I have tried also withoiut "c".
[image: Innebygd bilde 1]

Not quite sure I understand what you are trying to do here.
You have setup other macros to change application, incidentally I use CTRL+CMD+Letter for hot key as CONTROL+letter is used within many apps.

Why are you typing C
Try using the select menu option with Keyboard Maestro

Then I have set all to Enable but the one we are talking about. No results.
[image: Innebygd bilde 1]

There is no need to “dis” able all the other macros.

If the hotkey combination is unique, the macro will execute.

If there are two “LIVE/enabled” macros with the same hotkey, Keyboard Maestro will display a small window and ask you which one you want to execute. (This can actually be useful as I have a set of macros I do not use often ALL with the same hotkey combination).

a: Renable all your other macros
b: I assume that you can run Chrome from the dock or the application folder
c: add a display message at the start of the macro to show you are running the macro OK, this is a useful debug technique.
d: create another macro to use openurl with chrome. (I have used CTL+OPT+CMD+G a hot key), change the display prompt
e: add “the status menu is selected” as well as the hot-key as this is another way to check you are activating the macro
(the macro will be listed as a dropdown for the Keyboard Maestro icon in your top menu bar)

The above should show Chrome running on you macbook.
Does this solve your problem? If not, then I still do not understand why you were typing “C”

Hi again!

I think I havn't explained this propperly.

I have a shortcut to open google email. But the problem is that it opens a
new tab every time I use it.
I want it to go to the tab for Mail who is lying there on top together with
google calendar, my disk and so on. Open it again.
Can you give me that?
[image: Innebygd bilde 1]

You will need to write some AppleScript to ask Chrome for the list of tabs (or even the list of all windows, and then list of all tabs in each window) and find the one that has the right URL. Then if found, bring that to the front and select it, otherwise open a new URL.

Alternative: You could try a Chrome add-on that manages tabs. Your email could always be Tab position 1, and then you could just switch to Chrome and use Keyboard Maestro to select the correct tab.

But I do not know anything about AppleScript.

Hey Geir,

This was a bit pesky to write due to a bug in OSX affecting changing the index of windows in an application, but it’s working.

The script is run from an ‘Execute AppleScript’ Action in Keyboard Maestro.

It will run faster if you save it as an AppleScript FILE using the Applescript Editor (pre-Yosemite) or the Script Editor (Yosemite) — then run it as a script file instead of as a text-script.


# Auth: Christopher Stone <>
# dCre: 2015/05/14 12:30
# dMod: 2015/05/14 13:21
# Appl: Google Chrome, System Events
# Task: Bring Chrome Tab with Gmail to front if it exists - otherwise open Gmail in new window.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Google_Chrome, @System_Events, @GMail, @Open, @Switch, @Front

set _win to false
tell application "Google Chrome"
   set {idList, urlList} to {id, URL} of every tab of every window
end tell

set AppleScript's text item delimiters to return

if (urlList as text) contains "" = true then
   set theWin to 1
   repeat with i in urlList
      set theTab to 1
      repeat with n in i
         if n starts with "" then
            set {_win, _tab} to {theWin, theTab}
         end if
         set theTab to theTab + 1
      end repeat
      set theWin to theWin + 1
   end repeat
end if

if _win ≠ false then
   tell application "System Events"
      if quit delay ≠ 0 then set quit delay to 0
      tell process "Google Chrome"
         perform action "AXRaise" of window _win
      end tell
   end tell
   tell application "Google Chrome"
      tell front window to set active tab index to _tab
   end tell
   tell application "Google Chrome"
      set newWin to make new window
      tell newWin to set URL of active tab to ""
   end tell
end if


Tanks a lot to everybody to everybody who cares!

Thanks @ccstone for this, useful for me too.

Likewise, I just put this in place with a Hot Key and it works really nicely. Thanks very much for contributing the script. Being able to jump instantly to my Gmail tab from anywhere is just wonderful.

Hi !
Im not able to use this because I do nothing about script.
Is there a simple way to do it without script and a hotkey?

Hello Geir,

That's why I posted the script.

You have Keyboard Maestro — yes?

KM knows how to run a script using an 'Execute AppleScript' Action.


You can use a trigger other than a hotkey like a menu trigger.

Here's the script as a downloadable macro with F1 as the hotkey. You can easily change the trigger to suit yourself.


Google Chrome { Bring Gmail Tab to Front }.kmmacros (3.7 KB)

This is the way to do it!
Thanks a lot for your time, Ccstone!

This is a great step forward.

Could it be possible to make this happen also to Google calendar?, Contacts and even Google Disc?


Hey Geir,

I've been meaning to get back to this. Here's the same macro with the URL in the script altered to work with Google Calendar.

Google Chrome { Bring Google-Calendar Tab to Front }.kmmacros (3.7 KB)

If you want to create macros that manage other Google services all you have to do is find the shortest portion of the URL of the service that is consistent and replace the URL in the script.

I have altered the script, so you only have to enter the URL in 1 place.


I already installed chrome and just keep getting the sign in page. I guess I was between facebook and Pinterest more so they dropped my gmail acct. I created a new one but now the say they can’t find it! I’ve created another acct on google and this one is sticking with 2 emails from google. I gave the second email address to a friend who has also left facebook and now I have no way to contact him

Thanks @ccstone This is a very useful function!

1 Like