Colors and Locations

Previous: Random Zsigs

Up: Simple Zephyr Hacks and Customizations

Next: How To Ignore People


Colors and Locations

There are two main ways to change the colors and locations of your Zephyrgrams - either through your .Xresources file, which can be used to describes all of your X applications, or through your .zwgc.desc file, which describes only your Zephyrgrams. People often change the color and locations of Zephyrgrams for 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 locations of Zephyrgrams using the .Xresources file, it is first useful to understand the way the geometry is specified. 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.

The basic format of an entry to change geometry (location) of Zephyrgrams in your .Xresources 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:

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

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

This code has the same effects as the .Xresources entries listed before. Although it is somewhat longer, some people might opt to use the .zwgc.desc method because one could then also include other customizations to .zwgc.desc for those particular classes and instances at the same time. For example, you can change the way a message is formatted.

To get different colored zephyrs, you can modify 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, white-magic Zephyrgrams to show up as white on purple, personal messages to show up as yellow on blue, and mail notification to show up as red on black.