pan-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-users] Re: VDQ : xterm font size -- aaarrrgghhh ...


From: walt
Subject: [Pan-users] Re: VDQ : xterm font size -- aaarrrgghhh ...
Date: Fri, 5 Sep 2008 21:53:21 +0000 (UTC)

On Fri, 05 Sep 2008 19:18:37 +0000, Beartooth wrote:

>       Hmm ... One of my machines now has a special panel drawer, with
> launchers for all the terminals I could find. When I get around to
> snooping among them, I believe I'll start with xterm. Does it also do
> colors??

One thing I really like about the KDE terminal (kterm) is that it has
an option to set the background to a random color when you open it.
I use xterm now but I wanted that random color feature, so I wrote
this little C program:

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

int
main(void) 
{
        int r,g,b;              /* red, green, blue */
        struct timeval  t;      /* random bits */

        gettimeofday( &t, 0);
        b = (t.tv_usec << 4) | (t.tv_sec & 0x0f); /* 24 pseudo-random bits */
        b |= 0xc0c0c0;          /* force the rgb high bits to 11 */

        r = b & 0xff;           /* red */
        b >>= 8;                /* next 8 bits */
        g = b & 0xff;           /* green */
        b >>= 8;                /* next 8 bits for blue */

        printf("-bg rgb:%x/%x/%x\n", r, g, b);
        return(0);
}

The program prints e.g. "-bg rgb:d6/fd/df" where the d6/fd/df are pseudo-
random hexadecimal digits representing the xterm background color.

To make it work I run this little shell script:
exec xterm `rlc` -sb -fn 9x15
where rlc is the name of the C program (i.e. Random Light Color).

I named the shell script xtermrlc and put it in /usr/local/bin along
with rlc, then added a custom icon to my desktop to run the script.

You could do the same with the foreground color, but that's a bit too
1970's for my taste.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]