Colors and Locations

The colors and locations of your incoming zephyrgrams can be changed in two ways: through your .Xresources file, which can be used to customize all of your X applications, and through your .zwgc.desc file, which describes only your zephyrgrams. People often change the color and locations of zephyrgrams from different Zephyr classes and instances, including things like class login (for znol login and logout announcements), and class mail (for announcements of new mail).

To change where zephyrs appear, it is useful to first understand the way that geometry is specified in X. This is best explained by example. The top left corner of the screen is +0+0. The first number of this is the X coordinate and the second the Y coordinate. The right edge of the screen corresponds to an X coordinate of -0, and the bottom edge to a Y coordinate of -0. The lowercase letter c refers to the center of either the x or y axis. You can also use any integer to refer to a location on the screen. +0-20, for example, is near the bottom left corner of the screen, 20 pixels up from the bottom, while -100+100 is 100 pixels away from the right side of the screen and 100 pixels down from the top of the screen. In summary, positive numbers measure from the left and from the top, and negative numbers measure from the right and from the bottom; the horizontal position is the first number and the vertical position is the second number.

The basic format of an entry in your .Xresources file to change the geometry (location) of incoming zephyrgrams is:

zwgc*style.class.instance*geometry: +x-y

where +x-y is any combination of integers, as described above. Some examples follow:

zwgc*style.message.personal*geometry:           -0+0
zwgc*style.message.white-magic*geometry:        +c-0
zwgc*style.login*geometry:                      +0+0
zwgc*style.mail*geometry:                       +0+30

These four lines place personal zephyrgrams in the top right corner of the screen, zephyrgrams on instance white-magic in the bottom center of the screen, login and logout zephyrgrams (from znol) in the top left corner of the screen, and new mail notification zephyrgrams just below login and logout zephyrgrams in the top left corner of the screen.

To do something similar by editing your .zwgc.desc file you would need to have lines something like this (we have included comments in this code with #'s, to make clearer what it is actually doing since you will need to alter this significantly to meet your needs. Any line beginning with a # is a comment, and your zwgc will ignore it (whereas you should pay attention to it):

# looks at the name of the instance after converting it to lowercase
# since .zwgc.desc is case sensitive
case downcase($instance)
# things to do if instance name is white-magic
match "white-magic"
        set X_geometry = "+c-0"
# things to do if instance name is personal
match "personal"
        set X_geometry = "-0+0"
# stops looking at instances
endcase

# looks at the name of the class after converting it to lowercase
# since .zwgc.desc is case sensitive
case downcase($class)
# things to do if class name is login
match "login"
        set X_geometry = "+0+0"
# things to do if class name is mail
match "mail"
        set X_geometry = "+0+30"
# stops looking at classes
endcase

This code has the same effects as the .Xresources entries listed before. Although it is somewhat longer, some people opt to use the .zwgc.desc method because they can include additional customizations (other than position) to .zwgc.desc for those particular classes and instances at the same time. For example, you can change the way a message is formatted. The best way to learn how to do this is to look at other people's .zwgc.desc files and examine what the various commands are doing. Some examples can be found in the dotfiles locker. One particular .zwgc.desc file you might want to look at is rjbarbal's, which you can find in /mit/dotfiles/Zwgc.desc/rjbarbal.zwgc.desc (you need to type attach dotfiles first).

You can change the colors of incoming zephyrgrams by modifying your .Xresources file. The basic format of .Xresources entries for foreground and background colors for zephyrgrams is:

zwgc.style.class.instance*background: color

zwgc.style.class.instance*foreground: color

To avoid problems when you don't have a color screen, you can place your color preferences after a line reading

#ifdef COLOR

and follow them with a line reading

#endif

An example follows:

#ifdef COLOR

zwgc.style.login*background:                            LawnGreen
zwgc.style.login*foreground:                            MidnightBlue
zwgc.style.message.white-magic*background:              purple
zwgc.style.message.white-magic*foreground:              white
zwgc.style.message.personal*background:                 blue
zwgc.style.message.personal*foreground:                 yellow
zwgc.style.mail*background:                             red
zwgc.style.mail*foreground:                             black

#endif

These lines would cause login announcements to show up as MidnightBlue on LawnGreen, zephyrgrams in instancewhite-magic to show up as white on purple, personal messages to show up as yellow on blue, and mail notifications to show up as black on red.

Geoffrey G Thomas 2009-02-09