Page Graphic

A program I use for on-screen display.




One day, I realized that I like the on-screen displayed volume controls and the like on non-linux OS's, like OS X and some Windows installs. So I went looking for a solution.

I found a partial solution in The xosd Library. The problem was, it lacked a useful frontend.

So I wrote one.



To use onscreend, you have to have the xosd lib built and installed. You may have to edit onscreend.c and replace the font, since I use "Serpentine D", a very cool-looking but nonstandard font.

There are two binaries, onscreend and putfifo. onscreend is the actual program that displays the text. You should probably put it in your .Xclients file. putfifo is a simple application that will attempt to write standard input to the fifo named in the command-line. It differs from cat only in that if the fifo has no open readers, it returns immediately.

Whenever something wants to display a message on the screen, it should use a command like:

echo This is your message | putfifo /tmp/onscreen

If you want a single-tick slider, format your message like this:

echo \|50:This is your message | putfifo /tmp/onscreen

Or, for a volume-control-style slider, this way:

echo %50:This is your message | putfifo /tmp/onscreen

I have bindings all across my system for onscreend. I've added appropriate lines to my hotplug configuration files, so I get notification of USB device attaches, network connection and disconnection, and other similar things.


Image Window
A screenshot of my desktop, showing onscreend adjusting my mixer from within vtwm.

vtwm configuration

These are the lines I use in my vtwmrc file to control my mixer. They will likely work in many other twm-derived window managers as well, although I can only speak for twm and vtwm. I left out the actual button binding, but that should be relatively straight-forward. aumix does the actual control, so it should be obvious that it is required for these lines.

Function "show-mixer-pcm" { f.exec "echo %$(aumix -q | grep 'pcm ' | cut -d ' ' -f 2 | tr -d ','):PCM Volume | putfifo /tmp/onscreen" }
Function "show-mixer-main" { f.exec "echo %$(aumix -q | grep 'vol ' | cut -d ' ' -f 2 | tr -d ','):Main Volume | putfifo /tmp/onscreen" }
Function "mixer-up-pcm" { f.exec "aumix -w+5" f.function "show-mixer-pcm" }
Function "mixer-down-pcm" { f.exec "aumix -w-5" f.function "show-mixer-pcm" }
Function "mixer-up-main" { f.exec "aumix -v+5" f.function "show-mixer-main" }
Function "mixer-down-main" { f.exec "aumix -v-5" f.function "show-mixer-main" }

All material on these pages is Copyright (c) Jennifer E. Elaan. Vim