The keyboard shortcuts to switch between tabs in Safari are cmd-shift-{ (previous tab) and cmd-shift-} (next tab).
You can also use cmd-1, cmd-2, etc. to jump to the tab that corresponds with that number, up to 8 (e.g. cmd-5 will jump to the fifth tab from the left, from whichever tab you're currently on). cmd-9 will jump to the right-most tab.
I have tried the following key combinations in an attempt to do this, to no effect:
- Command+Return ...+Space
- Option+Return ...+Space
- Control+Return ...+Space
- Command+Shift+\ (The "Show All Tabs" Command on my Macbook)
This leads me to believe that it really is an oversight on Apple's part.
Kludge: Create An Automator Command to Simulate A Mouse Click
I used code that I found at https://discussions.apple.com/thread/3708948 to put together the following AppleScripts:
Attempt 1: Didn't Work
I ran this code in an Applescript wrapped in an Automator Service mapped to "Command+Shift+Option+Control+Space", using the numbers I get from pressing "Command+Control+Shift+4" to get the address for the area (600 pixels horizontal from left, 300 pixels vertical from top), and it would work in normal Safari (pressing the key combination would make the mouse click at that pixel address), but it had no effect when the same key command was run in the "Show All Tabs" mode in Safari!
on run {input, parameters}
tell application "System Events"
tell process "Safari"
click at {600, 300}
end tell
end tell
return input
end run
Attempt #2: Worked, but Not Feasible
I did get a key command working with the following Applescript wrapped in an Automator Service, but it took 5.125 seconds to complete:(
on run {input, parameters}
set x to 600
set y to 150
do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END"
return input
end run
Best Answer
Both the control key and Fn key are modifier keys, which generally aren't intended to trigger anything by themselves. I think that even a macro program (e.g. keyboard maestro ) probably won't trigger on just a mod key. I know that Alfred won't trigger a workflow on a mod key.
There is a program called Ukulele that lets you edit your keyboard layout, and that would make it possible to remap your keyboard's behavior to your heart's content, but either you'd need to live with those keys being remapped all the time, or you'd need to select the alternate keyboard you created when you're in Safari.
Long story short, I think it's possible but will take some work and be annoying.