I made two small Bash scripts. They are very short and simple, so I just paste them here:

chk-url-browser.sh

#!/bin/bash
# A script to check if select a url, if so, then open it in browser

# Or http://search.yahoo.com/search?p=
# Or http://search.live.com/results.aspx?q=
SEARCH_ENGINE="http://www.google.com/search?q="
# Or use firefox, opear, etc
LAUNCHER=xdg-open

url=$(xsel -o)
[[ $(egrep "(ht|f)tps?://" <<< $url) ]] || exit 1
$LAUNCHER "$url"

terminal-search.sh

#!/bin/bash
# A script to search text from X clipboard

# Or http://search.yahoo.com/search?p=
# Or http://search.live.com/results.aspx?q=
SEARCH_ENGINE="http://www.google.com/search?q="
# Or use firefox, opear, etc
LAUNCHER=xdg-open

text=$(xsel -o)
text=$(python -c """import urllib ; print urllib.quote('$text')""")
$LAUNCHER "$SEARCH_ENGINE$text"

If you are using VTE-based terminal, then you don’t need the first one. If you may also not need it, check out this post.

The second one also relies on Python to do URL encoding. I don’t know if there is a common program for that, but Python is quite common too.

I bind Win+R to chk-url-browser.sh and Win+G to terminal-search.sh in Fluxbox, using the following in ~/.fluxbox/keys:

# Open url
Mod4 R :Exec ~/bin/chk-url-browser.sh
# Search from terminal
Mod4 G :Exec ~/bin/terminal-search.sh