Quickly open Google Calendar Tab in Google Chrome from Alfred
I have pinned tabs for Calendar and Gmail, and I wanted to quickly jump to them from anywhere using Alfred.
Another option could have been to use Alfred’s Web Search feature to open a new tab. That would be a simple version of what I wanted, but I was curious to see if it was possible to go to an existing tab.
Additionally, Alfred offers another option with an Automation Task accessible in the Workflow menu (Automation > Automation Task > Extra Automation Task > Web Browser> Chromium > Switch to Chromium Browser Tab Matching URL
). I discovered that solution after implementing mine, but I decided to keep what I had because the Automation Task doesn’t properly handle having multiple Chrome windows opened, and I usually have several of them.
In the end, my solution is an Alfred Workflow I made that runs an AppleScript[1] when a keyword is entered in the Alfred command palette.
![[Capture d’écran 2025-07-01 à 09.49.43.png]]
The Keyword trigger configuration is simple: Take the keyword "calendar" with no argument. then make it look nice by adding a title, a subtext and Google Calendar icon.
![[Capture d’écran 2025-07-01 à 09.48.55.png]]
Add an AppleScript action with the following script:
on alfred_script(q)
tell application "Google Chrome"
activate
-- Loop through all windows
repeat with windowIndex from 1 to count of windows
set theWindow to window windowIndex
-- Loop through all tabs in the current window
repeat with tabIndex from 1 to count of tabs of theWindow
set currentTab to tab tabIndex of theWindow
set tabURL to URL of currentTab
-- Check if the tab contains Google Calendar
if tabURL contains "calendar.google.com" then
-- Make this window active and switch to the calendar tab
set index of theWindow to 1
set active tab index of theWindow to tabIndex
return -- Exit the script once found
end if
end repeat
end repeat
end tell
end alfred_script
I did the same for Gmail by using another Keyword trigger and the same script with the Gmail URL.
Now I can access my calendar and emails from anywhere!
Hey, let’s have a chat!.
Actually, Claude made the AppleScript. I still don’t understand how this language works, and didn’t take the time to get it. ↩︎
- Improve your automated testing : You will learn how to fix your tests and make them pass from things that slow you down to things that save you time. This is a self-paced video course in French.
- Helping your teams: I help software teams deliver better software sooner. We'll work on technical issues with code, test or architecture, or the process and organization depending on your needs. Book a free call where we'll discuss how things are going on your side and how I can help you.
- Deliver a talk in your organization: I have a few talks that I enjoy presenting, and I can share with your organization(meetup, conference, company, BBL). If you feel that we could work on a new topic together, let's discuss that.