PopClip hacking

[Tweet : nvALT]

I’ve obviously been on a PopClip kick lately. I run a lot of my little scripts through Services, but there are only so many shortcut combinations on a keyboard (and in my memory) and right clicking to run a Service is cumbersome. PopClip streamlines it for me, so I’m exploring…

Shorter titles

Here’s a quick tip that Pilot Moon posted on Twitter recently: you can change the labels of “Copy,” “Cut,” and “Paste” to short versions (e.g. “C”) in the PopClip bar. Just run the following in Terminal.

defaults write com.pilotmoon.popclip UseShortTitles -bool YES
killall PopClip && open -a PopClip

Restricting a PopClip extension to certain apps

A much more hackish tip.

If you’re an avid PopClip user, you probably have a popup window that’s overflowing. It sometimes takes at least two clicks to get to what you want, and it takes time to scan for the right button, and that all kind of defeats the purpose of PopClip. If this is the case for you (it is for me), it might be time to clean up the list.

If there are some extensions you can’t bear to part with but you only need in certain apps, you can restrict them from appearing everywhere else with a bit of hacking. In most cases this won’t be a huge help, but there are some extensions, for example, that I only need when editing text in a few specific editors, and some that I really only use when reading emails or browsing the web (e.g. SkypeCall).

This is something extension developers can choose to do when they build one, but in most cases they have no inkling of your specific use case. So, it’s up to you to do a little hacking.

It’s kind of easy to break these when editing the PLIST, but the worst case scenario is that your extension will refuse to load. Just make sure you have a backup of the original.

  1. Download a fresh copy of the extension you want to edit. Unzip it if it’s compressed, but don’t double click the .popclipextz file
  2. Rename the file from .popclipextz to .zip and then double click it
  3. Right click the .popclipext file that is extracted and choose “Show Package Contents”
  4. Find and open Config.plist in a text editor
  5. After the first <dict> tag (line 4) insert a block like this1

         <key>Required Apps</key>
  6. Modify the bundle identifier strings in the block above to match the applications you want the extension to show up in. It’s easiest to find the bundle identifier on the command line. Run:

     mdls -name kMDItemCFBundleIdentifier -r /Applications/AppName.app 

    The bundle ID will look like com.companyname.app.

  7. Save the Config.plist file
  8. Test it out by double clicking the enclosing folder in Finder. If the folder doesn’t have the extension .popclipext, you’ll need to add that for PopClip to recognize and load it.

    When loaded from a non-compressed folder, the extension doesn’t disappear after you double-click it. That’s ideal for testing. If you want to, you can re-zip the extension for distribution. Just zip the .popclipext folder (right click and “Compress…”) and rename it from .zip to .popclipextz.

There are a ton of other cool options for PopClip extensions, many of which I haven’t seen put to good use yet. If you’re curious what else you can do, check out the PopClip extension documentation.

  1. You can also use the key “Blocked Apps” with the same format to exclude just certain apps.