Detects wether input is a web page or a search phrase. If you type “o uzbl wiki” google will be queried on uzbl wiki, if you type “o uzbl.org” uzbl.org will be opened as a web page
#!/usr/bin/perl
my ($config,$pid,$xid,$fifo,$socket,$url,$title,@cmd) = @ARGV;
if($fifo eq "") { die "No fifo"; };
#If there are no dots in the first word or more than one word is suppllied expect a phrase for google. Else go to the uri specified.
if (index(@cmd[0], '.') == -1 || scalar @cmd > 1)
{
# Replace this with your search engine
qx(echo "uri http://www.google.de/search?q=@cmd" >> $fifo);
}
else
{
qx(echo "uri @cmd" >> $fifo);
}
Copy the above script to a directory of your choice and bind it for example with:
@bind o _ = spawn @scripts_dir/goto.pl %s
The above version did not work very well for me, so I created a JS version that does:
var o = '%s';
if(o.indexOf('.') > 0){
if(o.indexOf(':') < 0) o = 'http://' + o
window.location = o;
} else window.location = 'http://www.google.com/search?q=' + o + '&btnI=I\'m+Feeling+Lucky'
Copy the above script to a directory of your choice and bind it for example with:
@bind o _ = script @scripts_dir/goto.js '%s'