Invoking PopClip on an existing selection

[Tweet : ADN : nvALT]

I love PopClip, and have done quite a bit of hacking around with it. Once you get used to it and come to expect it popping up, the only annoyance is that all your handy tools aren’t there when you make a keyboard selection, or when you accidentally dismiss the popup before you choose the extension to run. Easily fixed, fortunately.

PopClip provides a simple AppleScript command, appear, so you can script the popup with a single-line script:

tell application "PopClip" to appear

(Or, for giggles, Application('com.pilotmoon.popclip').appear(); in JavaScript on Yosemite.)

Then all you need is an easy way to trigger that command. I use BetterTouchTool to expand all kinds of functionality on my Mac, so it’s my natural choice. I simply save the command as an AppleScript file (.scpt), and then use the Open Application / File... action. I have it triggered by a 2-finger swipe down from the top of my trackpad. You could also easily bind it to a keyboard shortcut in BetterTouchTool1.

With this, any time I have text selected by any means, I can just swipe down on my trackpad with two fingers, starting with my fingers above the top edge, and get the PopClip menu for the current selection. The sequence below shows me selecting a paragraph using one of my KeyBindings, and then invoking PopClip with the two finger swipe.

  1. You can also use FastScripts with a keyboard shortcut. I haven’t had much luck making it work with launchers (LaunchBar, Alfred, etc.), but I’m sure there are ways.