1. Switching tabs in Safari 4 with shortcuts, just like in Firefox

    As a heavy-user of Firefox, the biggest annoyance in Safari for me was the missing shortcuts for directly accessing tabs. In Firefox you can access the tabs by pressing Cmd+<number of tab>. For example, if you want to jump to your third tab you would press Cmd + 3 (⌘ + 3), however in Safari this loads the third bookmark from the bookmark toolbar - very annoying if you are used to a different behavior.

    Luckily there is a way to change this behavior and make Safari (4, not sure about 3) behave like Firefox with the help of this innocent looking piece of AppleScript:

    tell front window of application "Safari" to set current tab to tab 3

    Simple, isn’t it? Now, all we need to do is to figure out how to combine this script with the shortcuts. Thankfully there’s a small and free application called FastScripts Lite (hidden on the bottom of that page), it’s limited to ten shortcuts, but all we want are nine (since Cmd + 0 is assigned to a somewhat useful “Actual Size” function), so it’s perfect. If you need more shortcuts, you can purchase the full version.

    Let’s review that AppleScript above to ignore any errors caused by non-existing tabs:

    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

    Open Script Editor and create nine files from 1-9 in ~/Library/Scripts/Applications/Safari, let’s call them Tab1.scpt to Tab9.scpt and paste in each file the script from above, changing the 3 at the end of the long line to the current number. I have prepared a Zip with all nine files (SafariTabs.zip), so you don’t need to do this by yourself. Simply extract this file in ~/Library/Scripts/Applications/.

    Next, launch FastScripts, click on the icon in the toolbar at the top of the screen and go to FastScripts->Preferences:

    1. We want FastScripts to start when we log in.
    FastScripts1.jpg

    2. Assign Cmd+1 - Cmd+9 (or any other combinations) to the proper Tab-scripts
    FastScripts2.jpg

    Go back to Safari, and see the magic at work!

Notes

  1. blargasm posted this