[dwm] patch for colored status text

From: Jeremy Jay <dinkumator_AT_gmail.com>
Date: Thu, 4 Dec 2008 13:43:43 -0500

Another simple patch for anyone interested. Changes the way colors are
defined slighty, allowing you to create more color combinations. Then,
to color the status text from stdin you can simply use the color combo # as
follows:

echo -e "\x03 warning low battery" -- will be printed with the third color combo
echo -e "\x04 danger will robinson" -- will be printed with the fourth color combo
echo -e " normal text \x03 warning \x04 error \x01 normal again"

For example, my colors in config.h are:
    #define NUMCOLORS 4
    static const char colors[NUMCOLORS][ColLast][8] = {
      // border foreground background
      { "#000033", "#dddddd", "#000033" }, // normal
      { "#000088", "#ffffff", "#000088" }, // selected
      { "#ff0000", "#000000", "#ffff00" }, // urgent/warning (black on yellow)
      { "#ff0000", "#ffffff", "#ff0000" }, // error (white on red)
      // add more here
    };

Which, coupled with my own status script results in things like the attached image.

Hope someone else finds this handy, I let my battery die one too many
times because I never noticed how low it was...

Jeremy

colored_status.png
Received on Thu Dec 04 2008 - 18:43:43 UTC

This archive was generated by hypermail 2.2.0 : Thu Dec 04 2008 - 19:00:05 UTC