BetterTouchTool and Safari

EDIT: Mountain Lion seemed to have issues with this script, so download new version below or read more here: Safari New Window.

Few days ago I switched to BetterTouchTool from MagicPrefs because (1) MP somehow blocked clicks when MagicMouse was disconnected and I always had to quit the MP. And (2) BTT lets me configure the trackpad too.

BetterTouchTool lets you define tons of gestures for your Macbooks Trackpad, your MagicMouse and your MagicTrackpad. In addition to that it brings lots of new stuff to MacOS like Windows 7 like window snapping, window switchers etc…… Extensive explanation is at the BTT developer’s blog. I wanted to add a gesture (four-finger click) to bring up a new Safari window. BTT had Predefined actions to Open Application/File/Script… or Open URL. First of these unfortunately did not open new window, but instead activated one of the pre-existent windows (which I could do just by clicking the Safari Dock icon). The latter did bring up a new window, but I missed the chance to use Top Sites.

AppleScript to the rescue So I typed four lines in AppleScript and now have an action to pop up new Safari window:

tell application "Safari"
    activate
    make new document
end tell

I saved this as an Application to the /Applications folder just for faster startup and pointed BTT Open Application action to that file. Viola!

 

[maxbutton id=”3″]