This whole Google jQuery autosuggestion bothers the hell out of me. I mean, why would you use several keystrokes and possibly the mouse to find a page, continuously requesting suggestions in the background?
Often I use Google to find a page I can pretty safely identify with some simple keywords. For example, in an IRC conversation I want to give someone a link to Al Jazeera's page about current events in Egypt.
Stupid way: 1. fire up browser, 2. enter search terms in address bar (:tabopen in Vimperator), 3. wait for the kilobytes to trickle through the line, 4. find your way around the page, 5. select link, 6. copy it somehow, 7. switch back to IRC window, 8. paste URL. Estimated time amount: ranging from anywhere between 10 seconds to 30 seconds.
Clever way: write a shell script to extract "I am feeling lucky" result.
#!/bin/sh
test -z "$1" && exit 1
URL="`curl -s -i -e 'http://www.google.com' -A 'Firefox 23' \
-G -d hl=en -d btnI=lucky --data-urlencode q=\"$1\" \
http://www.google.com/search | grep '^Location:' | \
head -n 1 | cut -d' ' -f2 | tr -d '\r\n'`"
echo -n "$URL" | (xclip -i -display :0 -loops 0 ) &
/home/feh/bin/notify-wrapper "Google 1st result" "$URL"
(Footnote: You need a more or less sensible User-Agent string (-A
) as
well as a request on www.google.com, otherwise you won't be served a
result.)
Then, bind a key to open a prompt in which you'll enter your search term. For awesome, this is:
awful.key({ modkey }, "g",
function ()
awful.prompt.run({ prompt = "Google: " },
mypromptbox[mouse.screen].widget,
function (s)
awful.util.spawn("/home/feh/bin/glucky '" .. s .. "'")
end,
nil, nil)
end
),
The notify-wrapper
script uses DBus's notify-send
to make a little
notification box appear as soon as the URL is retrieved (which is,
like, instantaneous).
Clever way works like this now: 1. Press Mod1-g, 2. enter search term, 3. paste URL. Time you need to find a popular link: Time to type search string + 1 second. Huge time saver.