You too can change your "working" icon
John Buck
john at polyof.UUCP
Fri Nov 18 02:00:19 AEST 1988
Here is a little toy for you to play with... This program will allow you
to change the "AT&T Working" ICON that appears when your UNIX PC is
busy doing something. 'unshar' the archive below, and compile "wb.c".
I have included a couple of "sample" bitmaps for you to play with. One
is of a horse, "horse", the other is the default AT&T ball, with the
word "working", called "saveit".
To see the current "working" icon, simply run the program without any
arguments. To SET a new ICON, simple run the program and give it the
name "horse" (for example, "# wb horse"). Watch what happens next
time your "busy" icon lights up.
I'd be interested in seeing some of the ICONS people come up with. I
also have a program that makes UNIX display two icons: one when the system
is busy, and when when it is doing nothing. I don't think I'll distribute
this because it actually goes in and changes code in /unix (/dev/kmem),
and could have adverse effects if you have a slightly different /unix
version than we do.
John Buck
john at polyof.poly.edu john@[128.238.10.100]
trixie!polyof!john
john at polygraf.bitnet
---------------------Cut here and run through /bin/sh-------------------
echo wb.c
sed -e 's/^X//' <<"EOFwb.c" >wb.c
X/* wb -- Change "window/busy" indicator on bottom right of UNIX PC screen
X * Copyright (c) 1988 by John Buck
X * You may NOT include this program or its algorithm in any
X * product designed for sale. You can copy it for your own non-commercial
X * use only; this entire copyright notice must be included.
X */
X#include <stdio.h>
X#include <nlist.h>
X#include <sys/types.h>
X#include <sys/stat.h>
X
Xstruct nlist nl[2] = {
X { "wbraster" },
X { NULL }
X};
X
X/* The "working" bitmap is 21 high by 80 wide */
Xunsigned short wb[21][5];
Xint fd;
X
Xmain(argc, argv)
Xchar **argv;
X{
X FILE *fp;
X struct stat wins, nms;
X
X fp = NULL;
X /* Is the window driver there? */
X if(stat("/etc/lddrv/wind", &(wins)) == -1){
X fprintf(stderr, "%s: Ooops -- can't stat ", argv[0]);
X perror("/etc/lddrv/wind");
X exit(5);
X }
X /* Quick name-list lookup, saves spending lots of CPU time
X * each invokation
X */
X if(stat("/etc/lddrv/wbrast.nl", &nms) == -1 ||
X nms.st_mtime < wins.st_mtime ||
X (fp = fopen("/etc/lddrv/wbrast.nl", "r")) == NULL ||
X fread(&(nl[0]), sizeof (nl[0]), 1, fp) != 1){
X if(fp) fclose(fp);
X /* Too bad, have to do a lookup (once only?) */
X if(nlist("/etc/lddrv/wind", nl) < 0 || nl[0].n_value <= 0){
X fprintf(stderr, "%s: Bad namelist for %s\n", argv[0],
X nl[0].n_name);
X exit(2);
X }
X if((fp = fopen("/etc/lddrv/wbrast.nl", "w")) != NULL){
X fwrite(&(nl[0]), sizeof (nl[0]), 1, fp);
X fclose(fp);
X }
X }
X#ifdef DEBUG
X fprintf(stdout, "wbraster @ 0x%x\n", nl[0].n_value);
X#endif
X if((fd = open("/dev/kmem", 2)) == -1){
X perror("/dev/kmem");
X exit(3);
X }
X lseek(fd, nl[0].n_value, 0);
X /* If args, must be a filename containing a bitmap */
X if(argc > 1)
X dofile(argv[1]);
X else {
X /* Otherwise, just show us what is there */
X if(read(fd, &(wb[0][0]), 21*5*(sizeof (short))) != 21*5*(sizeof(short))){
X fprintf(stderr, "Error reading raster data\n");
X close(fd);
X exit(3);
X }
X printrast();
X }
X close(fd);
X exit(0);
X}
X
Xprintrast()
X{
X register unsigned short i, j, c, k;
X
X for(i = 0; i < 21; i++){
X for(j = 0; j < 5; j++){
X c = wb[i][j];
X for(k = 0; k < 16; k++, c >>= 1){
X if(c & 1)
X putchar('@');
X else
X putchar(' ');
X }
X }
X putchar('\n');
X }
X}
X
Xdofile(f)
Xchar *f;
X{
X FILE *fp;
X register unsigned short i, j, c, k;
X register char *s;
X char ibuf[258];
X
X if((fp = fopen(f, "r")) == NULL){
X fprintf(stderr, "Can't open ");
X perror(f);
X exit(3);
X }
X for(i = 0; i < 21; i++){
X if(fgets(ibuf, 256, fp) == NULL){
X fprintf(stderr, "Need 21 lines, only found %d\n", i);
X exit(6);
X }
X s = ibuf;
X for(j = 0; j < 5; j++){
X c = 0;
X for(k = 0; k < 16; k++, s++){
X if(*s == ' '){
X ;
X } else if(*s == '@'){
X c |= (1<<k);
X } else break;
X }
X wb[i][j] = c;
X }
X }
X write(fd, &(wb[0][0]), 21*5*(sizeof (short)));
X}
EOFwb.c
echo saveit
sed -e 's/^X//' <<"EOFsaveit" >saveit
X
X @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
X @ @
X @ @
X @ @
X @ @@@@@@@@ @
X @ @@@@@@@@ @
X @ @ @ @
X @ @@@@@@@@@@@@@@@@ @ @
X @ @@@@@@@@@@ @ @ @@ @ @@ @ @ @@ @ @@ @@ @
X @ @ @ @ @ @@ @ @ @ @@ @ @ @ @
X @ @@@@@@@@@@@@@@@@@@ @ @ @ @ @ @ @@ @ @ @ @ @ @
X @ @@@@@@@@@@ @ @ @ @ @ @ @ @ @ @ @ @ @ @
X @ @@@ @@ @ @ @ @ @ @ @@@ @
X @ @@@@@@@@@@@@ @ @
X @ @@@@@@@@ @@ @
X @ @
X @ @
X @ @
X @ @
X @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
EOFsaveit
echo horse
sed -e 's/^X//' <<"EOFhorse" >horse
X @ @
X @ @ @ @
X @ @ @ @
X @ @@@@@@ @
X @ @@@@@@ @@
X @ @@@@@@ @@@@
X @ @ @@@@@ @ @@@@@
X @ @@@ @@ @@@ @@ @@@
X @ @@ @ @ @@@@@@@
X @ @ @@ @@@@
X @ @ @@@@ @@
X @@@@@@@@@ @ @ @@@@@@@
X @@ @@ @ @ @@@@@@@@
X @ @ @@@@@@@@@@@@@@@@ @@@ @@@@@@@@
X @ @@@ @@ @ @@@@@@@@@@@@@@@@ @@@@@@@@ @@@@@
X @ @ @ @ @ @ @ @@@ @@@@@@@@@@@@@@
X @ @@@ @ @ @ @@@@ @@@@ @@ @@@@@@@@@
X@ @ @ @ @ @ @ @ @ @ @@
X@ @@@ @@ @ @ @ @ @ @@
X@@ @@ @@ @@ @@
X @@ @@ @@@@@@@@ @@
EOFhorse
More information about the Comp.sys.att
mailing list