4

I much prefer the way Chrome allows me to use +# key to switch directly to an open tab. For example: +3 takes me directly to tab 3 in Chrome, but in Safari it loads the third bookmark from the bookmark bar in the current tab.

How can I make Safari behave like Chrome when I'm using +# key shortcuts and switch tabs instead of loading bookmarks?

3

Window > Show Next Tab

Should display the keyboard shortcut to switch between open tabs, I have mine custom set but I believe the default keyboard shortcut is :

Control+-->

However if you want a specific tab to be populated corresponding to the number you can set custom keyboard shortcuts within Automator or go Ian's route


I was able to reproduce your desired results with Automator in conjunction with the AppleScript you provided :

Automator Walkthrough :

Follow the link to my Discussion

The general parameters are the same and I'm sure you smart enough to figure it out.

  1. Services Receive : NO INPUT
  2. In : Select Safari so this service isn't available outside the application
  3. Drag and Drop the 'Run AppleScript' action to the workflow
  4. Include the AppleScript code you provided
  5. Save the service - I saved mine in increments
  6. System Preferences > Keyboard > Shortcuts > Services > General > Safari Tab 3 (whatever you named yours)
  7. Create your shortcut : For some reason Apple has blocked CMD+#'s even though those shortcuts aren't used in the app as far as I diagnosed. I was able to successfully replicate your desired results with ++3, but your computer, do what makes you happy
  8. Enjoy for $0

EDIT If you use + + 1/2 they are already reserved for the History Menu (so you should change these in Keyboard > Shortcuts by altering the keyboard board shortcut for that menu title) and then + + 1/2 will be up for grabs again

RE-EDIT Apparently +#s are reserved for jumping to bookmarks. Since I don't have any it didn't prompt anything on my end. But again, all menu title keyboard short cuts can be altered with no work at all in the keyboard shortcut area in system preferences. So looks like you can use your Command + 1-9 buttons

  • What would an Automator solution look like? Could save the $10 that FastScripts cost to run the AppleScripts. – Ian C. Jan 26 '15 at 5:53
  • @IanC. a little work, but free, the OP would still have to utilize the applescript that you provided since there is no Safari library input receivers or actions in automator :/. I've given a detailed answer here on how to bind them to hot-keys, which the OP can deduce to strictly work for Safari solely. Automator is where it's at! – soulshined Jan 26 '15 at 5:57
  • Sorry @IanC. i'm typing from my iPhone. I can offer a detailed example when I get to my computer. I just realized you were the OP :) – soulshined Jan 26 '15 at 6:04
  • @IanC. updated for your review, no hard feelings if you don't fancy it, everyone is different, I am an automator aficionado and use it for everything I can but it's not for everyone, it does feel kind of hacky for some reason, I don't know why they blocked Command+# key-sequences – soulshined Jan 26 '15 at 6:31
2

I installed https://github.com/norio-nomura/EasySIMBL, and then installed https://github.com/rs/SafariTabSwitching

  • I should have specified I'm using Mavericks and Yosemite. I couldn't get that SIMBL plugin to work in Safari or 8, could you? – Ian C. Feb 6 '15 at 15:28
  • @IanC. I am using yosemite with Safari 8. One thing I did was to empty the bookmark bar. – lulalala Feb 7 '15 at 2:12
  • Ah. Yea, I have bookmarks. I think, like @soulshined's answer, that's the key to using any other solution. – Ian C. Feb 7 '15 at 4:30
2

The newest version of safari (9.0) seems to support this out of the box.

  • The question asks for solutions for Safari before 9.0 – nohillside Jan 11 '16 at 7:21
1

I found this very old blog post that lead me to a solution to this problem. You can use AppleScript like this to tell Safari to change to a specific tab:

try
    tell front window of application "Safari" to set current tab to tab 3
on error
    tell front window of application "Safari" to set current tab to last tab
end try

So if you create nine of these scripts, one for each h+# key combination from 1 to 9, you have the beginnings of a solution. All you need is a way to bind these scripts to shortcut keys.

The blog posts suggests saving each of these scripts in ~/Library/Scripts/Applications/Safari and then using a Safari plugin called FastScripts (the "Lite" version is free but limits you to ten script <-> shortcut pairings) to bind the key combinations +1 through 9 to each of the nine AppleScripts we created. The combinations should be set to only work when Safari is the active application.

Now you've got sane, Chrome-like keyboard shortcuts for fast tab access in Safari.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .