Add a ‘close’ button to the twm title bar.

Some time ago I talked about a simple customisation of twm on cygwin. There was one more thing I wanted to add to the .twmrc file. This line:

### close window
RightTitleButton "/home/username/installs/backdrops/close4.xbm" = f.delete

All this does is add a button to the right of the title bar, using the bitmap in close4.xbm and attach to it the action f.delete. The result looks like this:

A little 'close window' button added to the title bar in twm.

A little ‘close window’ button added to the title bar in twm.

The icon for this is one I made myself.  twm icons are little xbm (X windows bit map) files.  The standard ones don’t always have the file name extension, and they live in

/usr/include/X11/bitmaps

or on cygwin on (64-bit) Windows:

C:\cygwin64\usr\include\X11\bitmaps

But by putting the full path into the file name, you can store them locally and not need to mess around in root.  The four buttons look like this: Close window button 1 for twm.  Close window button 2 for twm.  Close window button 3 for twm.  Close window button 4 for twm.

Now, I could not directly upload xbm files to this blog, so these images are gifs and will not work for twm. However, you can go here and get the icons in the file ‘close_buttons.zip‘. Alternatively, something like GIMP or ImageMagick can probably turn the gifs back into xbms — although I don’t know if they’ll have the right colour depth.

Then put them somewhere in your local filespace and put the path into your .twmrc file and there you have it, a neat little button to close the application/dialogue/whatever.

Blah blah de blah blah.

Advertisements

Tags: , , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: