X tools, -*-text-*- This is just a small collection of small X-based toys. There's nothing especially clever here, just some stuff I've found to be useful. It's a bit of a mixed bag, really; just saves me some effort if I package them all up together. The collection may grow in future, if I can be bothered to write any more X toys. A couple of the toys require GTK. Sorry: I like GTK and I don't want to play with Athena or Xt or anything like that again, because they're nasty. The tools are described more fully in the accompanying manual pages. There's not much to know about any of them, though. xgetline Pops up a little window (with configurable text in it) asking the user to type in a piece of text, and then writes it to stdout. It's useful when a shell script wants to solicit a string from the user, and particularly handy in window manager config files. You can also turn off echo of the string being typed in, which may be useful for input of passwords, but that's not ever-so recommended. The basic idea is that you say something like if name=`xgetline -p Name`; then echo "Hello, $name, pleased to meet you!" else echo "You're no fun, are you?" fi and everything is lovely. xscsize Returns the size of an X display. The idea is that you can do something like eval `xscsize` in a `.xinitrc' file and then play with XWIDTH and XHEIGHT to decide exactly where to put various windows depending on how big the screen is. This sort of thing is quite handy if you use the same setup on lots of different systems or screens. xwait, xtell, xshutdown The traditional thing to do at the end of a `.xinitrc' file is to wait for the window manager to exit. This is unhelpful when the window manager doesn't like its configuration file, for example, because your entire session goes away. The idea (filched shamelessly from SGI, actually) is to end the script with a program which hangs around until told to go away by another X client. (I could have used any old IPC mechanism here, but it seemed silly to use something other than X.) The manual pages provide the low-level detail. Basically, though, you run `xwait', and it sleeps. When you run `xtell', it tells the `xwait' program to kill itself. `xshutdown' does essentially the same thing, only it pops up a pretty window asking you if you're sure before it does it. Notes and things All the code here is released under the GNU General Public License (included in the file COPYING in the distribution). I tested the code under Linux and not much else, but I'm usually fairly conservative about portability and there shouldn't be much hassle involved. If anyone wants to do an Xaw version of the GTK bits then I'll include that in the distribution; people using Motif or Qt need not apply.