Aaron James Young - Salem, Oregon

Website Design and Development

Improved Zim Clipper

Posted on Apr 8 2010 | Posted in Web/Tech | No Comments

(Final edit: The Zim plugin mentioned immediately below is now called “Quick Note” and is integrated with the default Zim download. So the script that I describe and provide here is now obsolete.)

(Edit 4/13/10: The Zim author has implemented a “Drop Window” plugin that provides this clipping functionality. It is in the Zim bzr source on Launchpad and – I would suppose – will be included in the next release of Zim. You can get it now from bzr or use the below script until the next version is released)

The Zim Desktop Wiki is a note-taking program that I’ve been using to keep track of all kinds of information – it’s my digital notebook.

I’ve always liked the Evernote-style clipping functionality, where I can select some text in my web browser or another program, hit a key combination, and have that text “clipped” or saved to my note-taking program.

Some time ago, I posted a small Linux bash script that accomplished this. It gets the job done but has several obvious drawbacks (I basically pieced it together with little knowledge). I’ve noticed my post has been linked from the Zim Wiki Tips and Tricks page, so I’ve been motivated to make the script a little better. Please note that this is just a temporary solution – the Zim author appears to be implementing this feature with tighter integration into Zim itself. Until that is complete, you’re welcome to download this and go crazy.

My new script (presented below) has a few improvements over the bash script I posted earlier:

Basic functionality: Select text that you want to remember. Hit a key combination, provide a title and location for your note, and the script will create a Zim page with the proper parameters and the selected text.

Problem with old script: Too many popup windows! The old script would pop up three windows in succession, asking for the note title, then the note location, then asking for any additional text to add to the note.
Solution: Ask for everything in one window. The new script pops up a single window with fields for the note title, note location, and the text for the new note. The selected text is already entered in the text field.

Problem with old script: Dependency on xsel, a little utility that doesn’t come installed by default in (for example) Ubuntu.
Solution: Uses Python (see below) gtk.Clipboard, as kindly suggested by the Zim author.

Problem with old script: Written in bash by someone (me) who doesn’t know how to script in bash.
Solution: The new script is written in Python by someone (me) who doesn’t know how to write Python. Actually, it’s kind of an improvement because from here I can start to learn Python, and continue to refine the script. I may post updates here from time to time, but don’t count on it.

Directions (sort of detailed):

  • Download and extract the file below
  • It contains three files: zimclip (the python script) and two ZimclipWindow UI files that create the window.
  • Move the UI files (ZimclipWindow.ui and ZimclipWindow.xml) to a location where they’re out of your way. Note where you’ve put them.
  • Open zimclip in a text editor. There are two user-configurable lines near the top (yeah, I know this is bad, just do it, OK?).
  • Enter the location of the UI files (the folder that you put them in)
  • Enter the location of the Zim notebook/namespace where you want to file the notes created by this script. Remember that with Zim, Folders ==  Notebooks (and namespaces are in sub-directories). You will be able to choose each time you use the script, but it’s nice to have a default.
  • Move zimclip to your executable path and create a global keybinding to launch it.

To use it, select some text and hit the keybinding. You’ll need to provide a title for your note and a folder location (Zim uses a pretty straightforward folder structure for pages). Hit “Ok” and (when you’re ready) go to Zim and choose “Tools” -> “Rebuild Index”. Your note should show up in the index sidebar.

Finally, here is the download link for the zip file.

Contact Me with questions, comments, suggestions.

Aaron James Young is a Salem, Oregon Web Designer and crazy runner / cyclist. He is husband to Evelyn and father to Hanna.

Did you enjoy this post? If so, please comment or check out the whole category of related posts: Web/Tech

Have your say!

From my portfolio...

Selection_008 full Hundini Screenshot Sunset XC Screenshot

Recent Blog Posts

Latest Twitter Updates

Want to tweet with me? Follow me on Twitter!

    Latest Delicious Bookmarks

    Here's the stuff I found interesting recently. Follow me on Delicious!