Super simple clipboard history for Linux.

· 210 words · 1 minute read

I recently switched from Gnome to i3 on my main laptop. So far, I'm enjoying the simplicity of piecing together my own desktop environment from small, specialized tools.

One thing I missed from Gnome was my clipboard history tool, Gpaste. I've come to expect that my previous dozen or more clipboard copies are a keystroke or two away and not lost forever.

While tweaking my i3 setup, I realized it would be possible to replicate some or even all of the functionality of GPaste using simple unix tools:

  • Ruby (could be another scripting language, or just Bash script, but I'm more familiar with Ruby)
  • xclip
  • dmenu

An hour or so later, I had this:

Upon startup, my .xinitrc file starts up clipd, which checks the clipboard every second for a new string. (Note, this only works for textual data at the moment.) It stores the last 100 unique items in the .clipboard-history file in my home directory.

The other piece to this is my .i3/config file, which has a keybinding for win+v.

This opens up dmenu with all the available clips. Once a selection is made via dmenu, the clip is stored in the clipboard for pasting the usual way.

It's not overly clever or advanced, but it seems to work.

Happy hacking!