I have been using these two almost trivial scripts for a few months now and they have become rather essential for my workflow.
#!/bin/sh
# clip2firefox - open selected text as firefox address
firefox "$(xclip -out)"
#!/bin/zsh
# clip2goog - google for selected text
selurl() {
setopt localoptions extendedglob
sel=$(xclip -out)
input=( ${(s::)sel} )
print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'()-])/%$(([##16]#match))}
}
firefox "http://google.com/search?q=$(selurl)"
I give them shortcuts with xbindkeys:
"clip2goog"
Mod4 + g
"clip2firefox"
Mod4 + o
… and instantly I can open any URL or google for every selection I made.
When I first read about these scripts, I thought they weren’t a big deal, but they are insanely useful, believe me.
NP: The Brian Jonestown Massacre—The Be Song