scrotwm-color-bar

This is a dirty-hack for the scrotwm spectrwm window manager that enables the text displayed in the bar to be color-ized using a simple markup language. See below for a screenshot.

With this hack added to scrotwm, the text-output from the bar_application will be displayed verbatim in the display using the bar_color specified in your .scrotwm.conf (just as it normally is), with the following 3 exceptions:

'#xxxxxx#' where xxxxxx is a 6-digit hex color code
This text will not be displayed, and any text appearing after it will be displayed in the color corresponding to the provided RGB hex color code (e.g. "ff0000" denotes red)
'##'
This text will not be displayed, and any text appearing after it will be displayed in the default color, specified by bar_color.
'\#'
Use this to print a literal '#' in the bar.

Example

Suppose that bar_color is set to white. Then the following text, output by the bar_application,

   "Hello #ff0000#world##!  My #00ff00#name## is #0000ff#Simon##."
would be displayed in the actual bar as
   Hello world!  My name is Simon.

Screenshot

Requisite screenshot. Click to enlarge. The bar is at the top.

The text being shown in the bar is a list of users logged into two machines, queried using finger(1). The server names are in magenta, and the user names are color-coded by how long they have been idle. The number of sessions of each user is printed after their name. (Note that the minimum idle time of any users' sessions is what's used).

Download & Using

Here: color_bar.c Tested and works great on scrotwm-0.9.5 through scrotwm-0.9.20.

Note that I am not providing patches for each snapshot/release. I will once development of scrowm settles down.

Integrating it into the scrotwm source file is rather straight-forward.

my 'finger' info in the screenshot above

The output you see in the screenshot above in the bar is generated from this program: myfinger.c

When compiled, running myfinger hostname will query using finger(1) the provided host and output to stdout a list of all users logged in, in the form usernameX where X denotes the number of login sessions for the given user, and username is colored (using the markup described above) as follows: active (0 idle time) is green, ≤ 10 minutes idle is yellow, and if older the color is red, with decreasing brightness (i.e. from #ff0000 to #660000).

The bar_action script I use to generat the output is: scrotwm-baraction.sh.