Add a bookmark to Pinboard
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
pinit.sh

README.md

Pinit

Add a bookmark to Pinboard. The URL may be given via standard input, as an argument, or copied from the clipboard.

I frequently want to bookmark a URL in Pinboard while not logged in. Maybe I'm in my primary browser but my Pinboard cookie has expired. Maybe I'm in a disposable browser where I'm not logged in to any accounts. Maybe I'm not in a browser at all, but someone sent me a link via email or a chat application. By binding this script to a keystroke, I can easily add a bookmark in any of these scenarios.

Requirements

  • xdotool is used to get the name of the window currently under the mouse pointer (to be used as the default bookmark name).
  • xclip is used to get the URL out of the clipboard.

Setup

  1. Buy a Pinboard account.
  2. Export your Pinboard user name $PINBOARD_USER and your Pinboard API key as $PINBOARD_KEY.
  3. There is no step 3.

Usage

I bind the script via sxhkd. The script uses interactive input, so rather than calling it directly, I execute it via a terminal (in my case termite, but any will do).

# ~/.config/sxhkd/sxhkdrc
super + d
    termite --title pinit -e ~/bin/pinit.sh

I use the i3 window manager. Because I gave the terminal a window title, I can tell i3 to float that window.

# ~/.config/i3/config
for_window [title="pinit"] floating enable

Now when I want to bookmark a URL I'll copy it to my clipboard and hit super + d.