gnotebook: Googlizer: GNOME's Handy Search Applet and Gift Horse of the Week
Looking a very tiny, useful gift horse in the mouth
I was spending some time haunting GNOME's ftp archive when I came across a tiny applet by Alan Cox called "googlizer." It's a simple program, comprised of a single .c file and all of 73 lines of code, including the copyright and license notice. Its sole purpose in life is to launch a Google query on whatever happens to be in your X clipboard when you click on its icon.
You can download googlizer from the GNOME ftp archive, where it's currently available as version 0.1.
There's not much to it, really: the .c file, a README that describes how to get it working, a Makefile that's all of eleven lines long, and the ever-present GPL in the COPYING file. It took two seconds to build on a Duron 650. Despite its small size, it's still handy, providing an even simpler interface than something like webferret and an interesting learning tool for budding GNOME programmers curious about how to feed the values of X selections to applications.
Building the program is done by typing make in the unpacked source directory and copying the resulting binary (googlizer) to /usr/local/bin. You then create a launcher for the GNOME panel with the command /usr/local/bin/googlizer. Unfortunately, it doesn't come with an icon, but I created my own and I'm happy to share the humble results of my plagiarization of an existing Sawfish icon with anyone who writes.
Ever one to look a gift horse in the mouth, even a very tiny, single-purpose gift horse, I was immediately irritated that if I didn't already have a browser window open, googlizer chose to open a new Netscape 4.7 window instead of launching Mozilla, which is what I use daily. The problem, though, wasn't with googlizer. It's with gnome-moz-remote, which is one of those little programs you don't ever have to worry about if you're a "one browser window at a time" sort of person. On the other hand, the rest of us have probably noticed by now that the default browser icon on the GNOME desktop calls just this program to varying results with gnome-moz-remote --newwin
Most people will get a new Netscape window. Debian users will get Mozilla if they have that installed, or Netscape as a fallback if they don't. It's a good idea, really: if you don't have a browser open, gnome-moz-remote picks one and launches it. If you do, the "--newwin" option tells it to open a new window of an existing instance of your browser no matter what it is. People who spend their days on several desktops will soon come to appreciate being able to open a new browser window wherever they are without having to go hunt down their running browser on another desktop.
gnome-moz-remote seems to get used several other places as well. Consider, for instance, gnome-terminal's handy ability to open a URL by left clicking the URL's text and selecting "open in browser." It's also an option for the latest, still-in-development Emacs v. 21 for previewing HTML buffers.
The problem comes in if you've got more than one browser floating around your system, or prefer a browser that isn't in the list at all. I know one person who uses Konqueror on their GNOME desktop, for instance. I have more than one Mozilla installed, too: there's the Mozilla 0.7 that Progeny provides (which I had around for back when Nautilus would use it) and the nightly builds I actually use every day. There's not much documentation floating around for gnome-moz-remote, and the --help option doesn't say much of use. It's an irritating problem, though, if you only keep Netscape around for emergencies (as in: the latest Mozilla nightly dies a lot and you're waiting for a better build). So how to fix gnome-moz-remote to launch the browser you want? It turns out it's fairly simple:
Create a file in ~/.gnome called gnome-moz-remote and put the following lines in it:
For instance, to use gnome-moz-remote with a copy of the latest Mozilla nightly I keep in my home directory, my ~/.gnome/gnome-moz-remote looks like this:
[Mozilla] filename=/home/mphall/bin/mozilla/mozillaMy Konqueror-using friend would use:
You can also create a system-wide default for gnome-moz-remote by placing the same file with the same contents in your system wide GNOME configuration directory.
One last thing came up with googlizer, once I figured out how to make the right browser launch when I used it, which was controlling the search engine it uses to do its searches. It doesn't require a lot of C wizardry (none, in fact) to open up the googlizer.c file in the program's distribution and go down to line 32, which looks like this:
tp=bptr+sprintf(bptr, "http://www.google.com/search?q=");and change it to suit your needs. I modified it to provide me with a tool for the LinuxToday search backend by changing that line to this:
tp=bptr+sprintf(bptr, "http://linuxtoday.com/search.php3?resulttype=link&query=");and rebuilt it, resulting in a, well, linuxtodayilizer. My X selections are fed to the LinuxToday search page now.
Though he probably doesn't believe it, I'll have an interview with Rodney Dawes, the man behind the small-but-fast Encompass browser coming up soon. And GNOME 1.4 is so close it may be here by the time you read this, which means it'll be time for another in-depth look.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Gives Up on Upstart, Ubuntu and Linux Kernel Updates