I recently discovered a fantastic Mac Pinboard client called Shiori. It provides a simple, clean, and best of all fast user interface for accessing and adding bookmarks to Pinboard (and Delicious). Bookmark retreival uses a wonderful little UI reminiscient of Alfred/Quicksilver that makes bookmark search ridiculously easy:
Adding a bookmark is similarly nice, and replaces the functional (yet not always delightful) default Pinboard bookmarklet:
However, one feature I really miss from the bookmarklet is the ability to automatically add any selected text on the web page you're saving as the description of the bookmark. This is a huge timesaver for me, as I like pull-quoting large sections of websites and using them as descriptions; makes finding said web sites later on a bit easier. Bummer.
However, after a few minutes in Keyboard Maestro1, I was able to whip up a shortcut that gets me exactly what I need:
The logic behind the script is actually pretty straightforward.
Whenever a hot key is triggerd (in my case, Ctrl+Cmd+S), perform the following actions:
- Get the current clipboard contents and save it to a variable.
- Perform a copy of whatever is currently selected.
- Save the new clipboard contents and save that to another variable.
- Trigger Shiori (in my case, with Ctrl+Shift+Cmd+S).
- Compare the newly copied clipboard text to the previous clipboard:
- If they don't match, it means text in your browser was selected and we should use that text to fill in the description field (by pressing Tab2 and then pasting. The last Shift+Tab's is for focusing the keyboard back on the Tag field).
- If they do match, then nothing was copied from the browser, so just Tab to the description field and don't do anything else.
- Set the clipboard back to its original contents (so you don't lose anything you had in there before you ran this macro).
You can download the macro here. Don't forget to change the hotkeys in the macro to match your setup/preferences. Let me know if you have any suggestions on how to make it better!
I actually adapted this macro from a very similar one I wrote a year or so ago that does the exact same thing in Reeder for Mac. If you're interested, you can download that version here. Will be useful assuming Reeder for Mac returns eventually. ↩
This macro will need a slight update if you have the Full Keyboard Access option in System Preferences set to "All controls". You'll need to Tab and Shift+Tab twice, otherwise it'll only select the plus button when run. Thanks to Dave Overton for pointing this out. ↩