Secret Tools LG #67


        Here is a collection of little-known tools, a couple of which, I find extremely useful every single day. I’ll warrant that most people have never heard of any of them. O.K., they are not exactly a secret – they are, after all, freely available on the net, but they do deserve more than the scant attention they receive.

        Even when you are looking for applications which will perform like ‘xsnap‘ or ‘xclip‘ they are difficult to find. Utilities like ‘showbook‘ and ‘splitvt‘ are sheer serendipity.


by Clauss Strauch at Carnegie Melon University et alia.

After using ‘Snap!’ for years, when I made the move to Linux, this was the app I searched high and low to replace. No, xsnap doesn’t have the OCR capabilities which were a part of ‘Snap!’, but it’s still very useful none the less.

Xsnap is a little app which takes screen-shots. Big deal. Lots of programs exist which do the same thing. The difference is that xsnap allows you to capture arbitrary areas of the screen (including entire windows or screens) and it’s fast.

When you run xsnap your mouse cursor will change to show an angle shape; simply position the cursor and ‘drag’ a rectangle describing the area of the screen you want in a snap-shot. That’s it. Press either ‘p’ or ‘w’ in the resulting window to save a numbered snapshot to your home directory.

It doesn’t sound like much, but when you want to email just a portion of an image, or make a little sticky-note for yourself as you peruse a website it’s just what you need. Actually, taking screen-shots of running apps is the least of what I use xsnap for. Making fast, simple sticky-notes of docs, emails and man pages for just a few minutes reference is where xsnap really shines.

Really, just take my word for it, xsnap is tremendously useful, especially when assigned to a hot-key like ‘print screen’ (what are you using it for anyway?). In fact, xsnap is almost wasted if it’s not attached to a global hot-key.

Unfortunately it saves it’s files as ‘xpm’s. These are very large.

As always though, we can script our way around such short-comings. Just make a script which processes the file for you on the fly. Here’s an example of a script I have attached to my hot-key:

# xsnap-jpg. Runs xsnap, converts to jpg and loads electric eyes.

xsnap -stdout | xpmtoppm | cjpeg -quality 75 >~/snap.jpg;ee ~/snap.jpg

To save typing it shift-click here. Then type ‘chmod 755 filename’ on the resulting download to make it executable. This will function just the same as xsnap except that files will be jpeg and you can do all that ee can do too – also you won’t have your home dir junked up with numbered files. ‘-quality 75’ is actually the default for cjpeg. Change the ’75’ to a lower or higher number to get the file sizes/quality you prefer.

I should mention that there’s one little extra step to compiling xsnap. You will find that it doesn’t come with a working makefile or a configure script. To create a makefile just type ‘xmkmf’ ( x make makefile). Then make as usual.

While you’re on that same page downloading xsnap , Lupe is a very nice magnifier with a few extras for colour and position (plus it has a cool ‘heads-up’ style display).


by Kim Saunders

Xclip is a very simple app. Why it wasn’t available to Linux users until now is beyond me.

Quite simply, it allows you to place whatever you wish into the clipboard. Period.

A simple example. Suppose you want to send your friend a directory listing; no problem. Just type « ls | xclip » at your nearest console and then middle-click to paste into your email. In fact any program’s std out can be piped to xclip: ‘whois’, ‘’ whatever.

In combination with a script to grab the currently selected text it becomes even more useful. Suppose you’ve just typed an unsorted list, but you want it sorted alphabetically. Highlight the list with the mouse, press, say, alt-shift-S and then middle-click to paste in the freshly sorted list! This trick can be used to do any number of things: sum a column of numbers, make banner-style comment blocks, quick-notes…

Here’s a python script which uses the wxWindows library to do all of the above. Just attach it to different hotkeys using the appropriate command line switch (e.g. ‘ -c’ to create comment blocks).
by Guido Socher

This little gem is indispensable if you have a lot of bookmarks. parses your Netscape bookmark file and returns the URLs it finds there. In fact, it’s so useful that even though I haven’t used Netscape in a couple of months I export my bookmarks file from Konqueror every once in a while just so I can keep using it! (nb: Konqueror mangles the syntax slightly, so you’ll need to run Netscape once and explicitly save bookmarks to sort things out.)

Here’s a sample search using

[paul@oremus paul]$ wxwin
== Misc ==

Yes, I had just used it to grab the URL I needed for wxWindows 🙂
by Landon Curt Noll. Email: « number-mail at asthe dot com »

Prepare to be humbled: This man has more degrees than a thermometer. The cv of anyone else looks positively anemic beside that of Mr. Noll’s. is the most thorough treatment of a « number to words » script I’ve ever seen. Granted, you may not use it everyday (unless you hook it into your cheque register), but it’s such a nice piece of perl I had to include it. I normally stop writing at the largest cheque I can conceive the customer to write. Not Mr. Noll:

[paul@oremus paul]$ 123456789123456789.12
one hundred twenty three quadrillion,
four hundred fifty six trillion,
seven hundred eighty nine billion,
one hundred twenty three million,
four hundred fifty six thousand,
seven hundred eighty nine

I’ve yet to break it.


by Sam Lantinga

Splitvt gives you two consoles in one by splitting the console horizontally. If you click on the thumbnail to the right you’ll immediately see how handy it is for viewing man pages while you’re building a command line. ‘Control-W’ is used to bounce back and forth between windows.

Splitvt works fine anywhere I’ve tried it. Everything from the real console to the tabbed notebook of konsole. No problems, very handy.


Princeton’s WordNet.
Email: Wordnet-email

Anyone who uses English should have a copy of WordNet on their machine. WordNet is a dictionary, not just a spell-checker, but a real, honest to goodness dictionary with meanings in context.

I must warn you that it is about a 10 megabyte download, but it’s worth it and you only need to do it once. Here’s some sample output from ‘wn’ ( the executable program that comes with WordNet) using the word ‘date’:

Overview of noun date

The noun date has 8 senses (first 8 from tagged texts)
1. date, day of the month -- (the specified day of the month; "what is the date 
2. date -- (a particular day specified as the time something will happen; "the 
date of the election is set by law")
3. date, appointment, engagement -- (a meeting arranged in advance; "she asked 
how to avoid kissing at the end of a date")
4. date -- (a particular but unspecified point in time; "they hoped to get 
together at an early date")
5. date -- (the present; "they are up to date"; "we haven't heard from them to 
6. date, escort -- (a participant in a date; "his date never stopped talking")
7. date -- (the particular year (usually according to the Gregorian calendar) 
that an event occurred; "he tried to memorize all the dates for his history 
8. date -- (sweet edible fruit of the date palm with a single long woody seed)

Overview of verb date

The verb date has 5 senses (first 3 from tagged texts)
1. date -- (go on a date with; "Tonight she is dating a former high school 
2. date, date stamp -- (stamp with a date, as of a postmark; "The package is 
dated November 24")
3. date -- (assign a date to; determine the (probable) date of; "Scientists 
often cannot date precisely archeological or prehistorical findings")
4. go steady, go out, date, see -- (date regularly; have a steady relationship 
with; "Did you know that she is seeing her psychiatrist?" "He is dating his 
former wife again!")
5. date -- (provide with a dateline; mark with a date; "She wrote the letter on 
Monday but she dated it Saturday so as not to reveal that she procrastinated")

Whew! Very complete eh? And the above output is actually truncated!

WordNet comes with a tcl/tk front-end which I’ve never actually had functioning. It seems to insist on an older version of tcl/tk. I normally call it from a hot-key (control-shift-E) with this little script which uses gdialog for input and output. I think gdialog comes with most major distributions. Xdialog is very nice too and basically a drop-in replacement.

In a similar vein, and to show how easy it is to adapt a script, WORDS for LINUX (i86) is a Latin dictionary you can use the same way. The script is here. In fact I should probably make a copy of it which uses… Now, why not round out your bookshelf with a thesaurus? gThe is just the ticket. You can find it here. Sampo Niskanen has done a nice job with this using a freely available thesaurus. I would like the gui to accept an argument from the command line though. I must remember to write and ask if he’d do that sometime.

Keybindings and other Adventures

Some of you may be wondering why I haven’t mentioned exactly how to attach a program to a hot-key in the first place. The answer is a simple one: I don’t know.

That is, I don’t know how you can do it, because I don’t know which desktop you are running. They all seem to employ different methods – if they have one at all. What follows here is not an exhaustive study, but I did spend more than a couple of hours playing around. If you know of a method that will work globally with every desktop please send me an email. My results, outside of two desktops, have been abysmal. I’ve tried the xmodmap route, but, beside the fact that I didn’t actually break anything, I didn’t achieve anything either… In case it’s early in the day for you, this is an anguished cry for some help with this one.

READ  IP Sub-Networking Mini-Howto: Routing


As some may have noticed from the screen-shots, I was using IceWM at the time. The theme in the screen-shots is my own peculiar blend of « blue plastic » and « Photon » (I always wanted LED’s that lit up when you clicked them). In fact, I lived in IceWM for a couple of months. It’s a very nice, light-weight desktop and I found it to be both servicable and stable. If you are using it without IcePref (by David Mortensen) and iceme (by Dirk Moebius) you are really missing out. Both are written in python, so you’re free to play. The first thing you should do after running iceme is use it to add itself to the menus. Now, you can have iceme whenever you want. Another benifit is that iceme has the ability to call IcePref, so you get the best of both in one go. iceme makes it so very easy to make hot-keys that I’m not even going to describe the procedure. Both these guys should be sent beer and Swedish cookies at your earliest convenience.


Alas1, this was one of my failures. I have no idea what I’m doing wrong. The Sawfish configurator had a couple of likely looking candidates in the (extensive) list, but I failed to get xsnap attached to a key and come up normally. I just know that this has to be a manifestation of my own density :-). As I wrote earlier: Help…


In KDE’s 1.x versions there was an app call khotkeys. It had a nice gui, but you had to do a little work to make it print arbitrary strings (like a long email address at the touch of a key). Since 2.0+ some of that functionality is gone, because it hasn’t been re-written yet. However, all of the above can be done if you create menu entries for every script and use kmenu to assign it a key. Simple.

Simple if you’re not running Mandrake. Don’t get me wrong, Mandrake’s distro is great, Great even. I’ve been using it exclusively since the 6.2 version. The problem is that it doesn’t even include kmenu and its supporting library. Given that khotkeys hasn’t yet been ported to 2.x this is reasonable, but it leaves us a bit ‘out in the cold’ when we need hot-keys!

Fear not. There’s always a way! Under KDE 2..x there is no need to run khotkeys explicitly – it’s just there. If you don’t want to download kmenu et al and you are running Mandrake, here’s all you need to do:

Load the file « /home/yourdir/.kde/share/config/khotkeysrc » into your favourite editor. It has an entry at the top for number of sections, just increment that by one whenever you add a section. You can make entries for things which point to an already existing menu item or you can just make one up. Here is an example of each:

An entry that points to a menu item:

Name=K Menu - Graphics/xsnap-jpg.desktop

An entry that points to just a command line:


After you have added your changes to the khotkeysrc file you can tell khotkeys to re-load its configuration using dcop. This is an ‘InterProcess COmmunication Protocol’ or IPC. What this means is that you can ‘talk’ to programs while they are running and tell them what to do. Type ‘kdcop’ in an xterm to see what’s available. Here’s the command line to run in order to get khotkeys to re-read its config:

dcop khotkeys khotkeys reread_configuration

There are two other peculiarities with KDE that I should mention. One concerns your environment and the other the clipboard.

First, your menus when you start KDE with Mandrake. Mandrake has written their own, custom ‘startkde’ script. And with good reason: it spreads common menu entries around in a consistent manner. However, this means that whenever you log in to X using KDE, Mandrake’s script will overwrite the additional entries made by either kmenu or yourself. Solution: take write permissions away from everyone – even yourself – for the directories and entries that you make by hand in ‘.kde/share/applnk-mdk’. This will cause a few errors to be written to your ‘.xsession-errors’ file, but it will keep your work safe.

Second, Mandrake’s re-write of the ‘startkde’ script (and I’m not kicking against that at all) does not recognize your environment . When started from kdm, the graphical log-in manager, you end up in a desktop which has no clue to the paths and aliases that you’ve set up. A quick solution to this is to modify Mandrake’s ‘startkde’ script which is found in /usr/bin. Just add these lines near the top: source $HOME/.bashrc source $HOME/.bash_profile

This way it reads your environment as if you had begun with ‘startx’ from a console.

I may, easily, have missed your favourite desktop in this (heck, I only surveyed 3 out of a zillion). Please drop me a line with how yours works.

So, that’s it right?

Well, nearly.

That’s almost it, but I’d be remiss if I didn’t talk about the clipboard a bit.

‘Windows’/’OS2’ has 256 clipboards and so does the ‘Amiga’. ‘X’ has the same – plus. Under ‘X’ there exists the same, static, 256 clipboard entries plus what is called the ‘Primary Selection’. This is the text that is actually highlighted at the moment. The ‘Secondary Selection’ refers to the usual 256 clibboard entries. Generally speaking, whatever is highlighted at the moment may be ‘pasted’ by pressing the middle mouse button. Very slick.

Unfortunately, things can get a bit muddled and you are entirely at the mercy of the toolkit as to how this all plays out. I have noticed that under KDE2x something is stealing the selection focus. I’ve tried turning off klipper, but to no avail. In practice, this makes the ‘clipmanip’ scripts useless, because the focus is stolen before you can paste the manipulated clipboard contents.

Fear not brave soul! We can play this game out. If we can’t have a general solution, we just have to aproach things a bit, well, side-ways. We will not be thwarted by a mere difference in clipboard conventions. With the exception of ‘clipmanip -n’ we seem to be done for, but don’t count us out just yet…

We turn for succor to our Trusty Editor. Now, I’m well aware that actually espousing a particular editor is little like offering to choose which under-garments you wear, but hear me out on this one.

We can use the same ideas, but ‘shield them from attack’ from the destop by doing it all inside our editor. All we need is a friendly editor. In strictly geek-speak ’emacs’ is cool, because it’s written in lisp and it’s scriptable in lisp. Now, we, who merely aspire to be Geeks, can use Glimmer by Chris Phelps.

Glimmer is not actually written in python (it’s C++), but it’s so tightly integrated that one hardly notices. I think the Scintilla project and wxwindows will allow a fully python solution any day now. I’ve used both and they’re marvelous. Glimmer exposes many of its methods to python and that’s what makes it so wonderful. You can script anything you want. All you have to do is write a python script and leave it in ‘/home/yourname/.glimmer/scripts’ and it will be added to the ‘Scripts’ menu. Building on what was given to me in the distribution, I offer the glimmer equivalents of the above mentioned scripts here. They are all self-similar and easy to follow along. I’ve learned alot since I wrote them, but I’m biting the bullet and leaving them the way they were at the time. ( I just took up python a couple of months ago, python/wxwindows is the most sheer fun I’ve had in years of scripting).

Since you’ve hung in this long, I’ll give you one more: baudline. This app is such overkill for anything we mortals could apply it to , I almost didn’t mention it at all. Baudline is the King of freely available audio tools. I wrote my thanks to the author, but I was a bit worried that he might not appreciate Baudline‘s demise at my hands: answering the phone. I was wrong. Since then, the author, Erik Olson, has added direct support for both rmd’s and mp3’s et al. If you need to edit/analyse sound look no further.

I hope I have, at least, aroused your curiosity about some of these things. With the exception of WordNet, they are all small downloads. Have fun!


1 If Jerry Pournelle actually has a copyright on this word, I want to plead ignorance now.

note-3888778Paul Evans

Paul Evans loves everything about electronics and computers in particular. He is old enough to remember drooling over an Altair 8080A in his adolescence. He and his two children live in the Wilds of Northern British Columbia; they’re not lumberjacks, but they’re OK.

Copyright © 2001, Paul Evans.
Copying license
Published in Issue 67 of Linux Gazette, June 2001