Brandon Invergo

Accessing the Gnome clipboard in Uzbl

In my post about my Gnome-Shell workflow, I stated that a trouble I had with browsing with Uzbl in Gnome was it usage of the primary selection clipboard via xclip. I had a hunch that it would be easy to get around this and, indeed, it was. It turns out, when you actually read the man pages for software, you end up learning a lot! xclip allows you to specify which selection to use, so it was as simple as adding the -selection clipboard flag in the appropriate places in my Uzbl config file. The copying & pasting keybinds section of my config now looks like this:

# Yanking & pasting binds
@cbind  Yu  = sh 'echo -n "$UZBL_URI" | xclip'
@cbind  yu  = sh 'echo -n "$UZBL_URI" | xclip -selection clipboard'
@cbind  yU  = sh 'echo -n "" | xclip' '\@SELECTED_URI -selection clipboard'
@cbind  yy  = sh 'echo -n "$UZBL_TITLE" | xclip -selection clipboard'

# Go the page from primary selection
@cbind  P   = sh 'echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'
# Go to the page in clipboard
@cbind  p   = sh 'echo "uri $(xclip -selection clipboard -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"'

Since I use Gnome's clipboard more often than the primary selection, I set the lowercase bindings to copy/paste there, while the uppercase bindings use the primary selection. And there you have it: better clipboard integration with Gnome in Uzbl.

Creative Commons License
Accsessing the Gnome Clipboard in Uzbl by Brandon Invergo is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.