floatbg-1.0.orig/ 40755 764 764 0 6234524727 12034 5ustar joeyjoeyfloatbg-1.0.orig/README100664 764 764 3542 6234524727 13017 0ustar joeyjoeyFloatbg is a little X-application that slowly modifies the color of the root-window. You won't be able to see the color change, but after a quarter of an hour, you'll notice that it did change, however. The program does have a minimal processor time consumption, as it sleeps most of the time and its computations are not complicated. After having run for more than two hours, `ps ux' on my sparc reported the following: USER PID %CPU %MEM SZ RSS TT STAT START TIME COMMAND rekers 849 0.0 0.7 52 80 p3 S 12:14 0:00 floatbg Floatbg doesn't use any window, button or menu, and it can only be stopped by killing it. This is a feature I don't like too much, but making a realy nice user interface is just too much for such a little joke... Floatbg starts with a random color and changes it deterministicly by moving through a hsv-model of colors. In the hsv-model, colors are described by three parameters: h = hue stands for the tint of a color (0 degrees is red, 60 = yellow, 120 = green, 180 = aquamarine, etc) s = saturations stands for the brightness of the color (0 = white, 1 = bright) v = value stands for the intensity of the color (0 = black, 1 = normal) Every 10 seconds the hue is increased by 1 degree and the saturation is changed by a sinus over the hue. The value remains fixed. The default values are chosen such that all pastel tints are visited, but these can of course be customized: usage: floatbg [options] where options are: -display or -d -help -value (default 0.87) -satmid (default 0.375) -satvar (default 0.125) -fase (default 0.25) value, (satmid-satvar) and (satmid+satvar) must be between 0 and 1 Floatbg is free and yours! I would like to hear about changes people made on it. Amsterdam, September 18, 1989. Jan Rekers (email: rekers@cwi.nl) floatbg-1.0.orig/Makefile100664 764 764 352 6234524727 13553 0ustar joeyjoey floatbg: floatbg.o cc -O -o floatbg floatbg.o -lX11 -lm floatbg.o: floatbg.c cc -O -c floatbg.c clean: rm -f floatbg floatbg.o floatbg.shar core a.out shar: shar -h floatbg.shar README Makefile Imakefile floatbg.c floatbg.man floatbg-1.0.orig/Imakefile100664 764 764 217 6234524727 13724 0ustar joeyjoey LOCAL_LIBRARIES = $(XLIB) SRCS = floatbg.c OBJS = floatbg.o SYSLAST_LIBRARIES = -lm ComplexProgramTarget(floatbg) floatbg-1.0.orig/floatbg.c100664 764 764 10721 6234524727 13736 0ustar joeyjoey/* * floatbg.c * author: Jan Rekers * purpose: This program slowly changes the color of the root window of X. */ #include #include #define MaxColor 0xffff #define MaxTime 0x7fff #define pi 3.1415926535 #define default_sf_in_hf .25 #define default_s_mid .375 #define default_s_var .125 #define default_v_val .87 char *program_name; Display *dpy; int screen; Window root; struct hsv { float h,s,v; }; struct rgb { float r,g,b; }; void hsv2rgb(), ticks2hsv(); float sf_in_hf = default_sf_in_hf; float s_mid = default_s_mid; float s_var = default_s_var; float v_val = default_v_val; unsigned long GetMutableColor(); void SetColor(); long time(), random(); double atof(); usage() { fprintf(stderr, "usage: %s [options]\n", program_name); fprintf(stderr, " where options are:\n"); fprintf(stderr, " -display or -d \n"); fprintf(stderr, " -help\n"); fprintf(stderr, " -value (default %1.2f)\n", default_v_val); fprintf(stderr, " -satmid (default %1.3f)\n", default_s_mid); fprintf(stderr, " -satvar (default %1.3f)\n", default_s_var); fprintf(stderr, " -fase (default %1.2f)\n", default_sf_in_hf); fprintf(stderr, " value, (satmid-satvar) and (satmid+satvar) must be between 0 and 1\n"); exit(1); } main(argc, argv) int argc; char **argv; { char *display_name = NULL; unsigned long cmapentry; register int ticks; int i; struct hsv hsv; struct rgb rgb; extern char *optarg; program_name=argv[0]; for (i = 1; i < argc; i++) { if (!strcmp ("-display", argv[i]) || !strcmp ("-d", argv[i])) { if (++i>=argc) usage (); display_name = argv[i]; continue; } if (!strcmp("-help", argv[i])) { usage(); } if (!strcmp("-value", argv[i])) { if (++i>=argc) usage(); v_val = atof(argv[i]); continue; } if (!strcmp("-satmid", argv[i])) { if (++i>=argc) usage(); s_mid = atof(argv[i]); continue; } if (!strcmp("-satvar", argv[i])) { if (++i>=argc) usage(); s_var = atof(argv[i]); continue; } if (!strcmp("-fase", argv[i])) { if (++i>=argc) usage(); sf_in_hf = atof(argv[i]); continue; } usage(); } if ( (v_val < 0) || (v_val > 1) ) usage(); if ( ((s_mid - s_var) < 0) || ((s_mid + s_var) > 1) ) usage(); dpy = XOpenDisplay(display_name); if (!dpy) { fprintf(stderr, "%s: unable to open display '%s'\n", program_name, XDisplayName (display_name)); exit(1); } screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); srandom( (int)time(0L) ); ticks = (int)random() % MaxTime; cmapentry = GetMutableColor(); XSetWindowBackground(dpy, root, cmapentry); XClearWindow(dpy, root); while ( 1 ) { ticks2hsv(ticks, &hsv); hsv2rgb(&hsv, &rgb); SetColor(cmapentry, &rgb); XFlush(dpy); ticks = ticks++ % MaxTime; sleep(10); } } unsigned long GetMutableColor () { XColor color; if (XAllocColorCells (dpy, DefaultColormap(dpy,screen), 0, 0, 0, &color.pixel, 1) == NULL) { fprintf(stderr, "%s: unable to allocate colorcells\n", program_name); exit(1); } return(color.pixel); } void SetColor (pixel, rgb) unsigned long pixel; struct rgb *rgb; { XColor color; int red = (int) MaxColor * rgb->r; int green = (int) MaxColor * rgb->g; int blue = (int) MaxColor * rgb->b; color.red = red; color.green = green; color.blue = blue; color.pixel = pixel; color.flags = DoRed|DoGreen|DoBlue; XStoreColor(dpy, DefaultColormap(dpy,screen), &color); } void ticks2hsv (ticks, hsv) int ticks; struct hsv *hsv; { float s_fase, sin(); hsv->h = ticks % 360; s_fase = sf_in_hf * (pi / 180) * ticks; hsv->s = s_mid - (s_var * sin(s_fase)); hsv->v = v_val; } void hsv2rgb (hsv, rgb) struct hsv *hsv; struct rgb *rgb; { int i; float f, p, q, r, h, v; v = hsv->v; if (hsv->s == 0) { rgb->r = v; rgb->g = v; rgb->b = v; } else { h = hsv->h / 60; i = (int) h; f = h - i; p = hsv->v * (1 - hsv->s); q = hsv->v * (1 - (hsv->s * f)); r = hsv->v * (1 - (hsv->s * (1 - f))); switch (i) { case 0: rgb->r = v; rgb->g = r; rgb->b = p; break; case 1: rgb->r = q; rgb->g = v; rgb->b = p; break; case 2: rgb->r = p; rgb->g = v; rgb->b = r; break; case 3: rgb->r = p; rgb->g = q; rgb->b = v; break; case 4: rgb->r = r; rgb->g = p; rgb->b = v; break; case 5: rgb->r = v; rgb->g = p; rgb->b = q; break; } } } floatbg-1.0.orig/floatbg.man100664 764 764 2605 6234524727 14251 0ustar joeyjoey.TH floatbg 1X .SH NAME floatbg \- slowly modify the color of the X root window .SH SYNTAX \fBfloatbg\fP [-display \fIdisplay\fP] [-help] [-value \fIfloat\fP] [-satmid \fIfloat\fP] [-satvar \fIfloat\fP] [-fase \fIfloat\fP] .SH DESCRIPTION Floatbg is an X11 program that modifies the color of the root window in such a manner that you won't to see the color change, but after a while you'll notice that it did change, however. .PP Floatbg starts with a random color and changes it deterministicly by moving through a hsv-model of colors. In the hsv-model, colors are described by three parameters: Hue stands for the tint of a color (0 degrees is red, 60 = yellow, 120 = green, 180 = aquamarine, etc), saturations stands for the brightness of the color (0 = white, 1 = bright), and value stands for the intensity of the color (0 = black, 1 = normal). .PP Every 10 seconds the hue (tint) is increased by one degree and the saturation (brightness) is changed by a sinus over the hue. The shape of this sinus can be addapted with the options -satmid, -satvar and -fase. The value (blackness) is fixed and can be set with the option -value. The default values are: \fIfloatbg -value .87 -satmid .375 -satvar .125 -fase .25\fP, and are such that all pastel tints are visited. .SH BUGS Floatbg doesn't use any window, button or menu, and it can only be stopped by killing it. .SH AUTHOR Jan Rekers \- rekers@cwi.nl