Customizing X Window
This help page will introduce you to some of the basic initialization files used by X Windows. These files can modified so that the X Windows environment can be customized.
When you start up X Windows, you will get the default X Windows environment. There are several files which "startwin" (the start-up script) reads in order to determine what your environment will look like. These files are:
| .x11-init | information about what applications to start up and where |
| .tvtwmrc | customize the workspace such as the menus, panner, and IconManager. |
| .Xdefaults | resources (characteristics) of applications |
The system default versions of these files can be found in the following places:
| .x11-init | /usr/usc/lib/startwin/X11/x11-init |
| .tvtwmrc | /usr/usc/lib/startwin/tvtwm/tvtwmrc.X11R5 |
| .Xdefaults | /usr/usc/lib/startwin/Xresources |
x11-init
The ".x11-init" file can be used to start up applications such as a file manager, an xterm, or a clock whenever X Windows starts up. Here is an example ".openwin-init" file:
xterm -geometry 80x30-0-0 &
clock -geometry 110x60+843+3 -digital +date -bg black -fg green &
xsetroot -solid lightsalmon &
This starts up an xterm in the lower right corner, a clock in the upper right, and sets the background color to be lightsalmon.
The options for applications can be found in their man pages. (For example, "man xterm".) The options which are common to all X Windows applications can be found by typing "man xview". Or if you want to find all the options to the program use the "-help" option. Example, if you wanted all the options for an xterm, type in "xterm -help" at the unix prompt.
If you have an image that you would like to be loaded into the background each time you start up X Windows, the .x11-init file is where you would want to put your `xloadimage' or `xv' command. For example, to load a image file called "cat.gif" into the background add the following command to your .x11-init file:
xloadimage -onroot cat.gif
The geometry for an application is specified in pixels. Geometry is specified in pixels with the following syntax:
widthxheight+x+y
The x and y locations of an application can be given with plus or minus pixel locations relative to a corner of the screen. Here is the designation for the corners of the screen:
------------------------- |+0+0 -0+0 | | | | | | | |+0-0 -0-0 | -------------------------
tvtwmrc
The ".tvtwmrc" file is used to change the way the default workspace looks. If you look in the default file, you can see how most items are defined. If you want to add entries, just copy the general format of the default file.
Just about anything that you want to customize, you can do it in the .tvtwmrc file. The most common thing that people like to change is the colors of the workspace. Here is a sample within the .tvtwmrc file:
Color
{
MenuForeground "cyan"
MenuBackground "black"
BorderTileForeground "blue"
BorderTileBackground "springgreen"
PannerBackground "DeepSkyBlue3"
PannerForeground "red"
}
Always remember to complete the curly brackets, or else when you next start up a window session, you'll get a lot of errors.
Colors can be specified with either their text name or an octal designation. A list of all available colors can be found in the
file /usr/usc/X11R5/lib/X11/rgb.txt. A program called xco will display colors and their names for you to view.
You can play with changing the foreground and background colors of the window by clicking the right mouse button over a color to change the
background to that color. Click the left mouse button over a color to change the foreground color to that color.
Menu customizing is also done in the .tvtwmrc file. You can change the menus, and define the mouse buttons to your wishes.
# Button definitions.
#Button = KEYS : CONTEXT : FUNCTION
#------------------------------------------
Button1 = : root : f.menu "defops"
Button2 = c : all : f.kill
Button3 = : root : f.menu "Main Menu"
The Button field corresponds to the button of your mouse. The Key field shows what key to press when you hit the appropriate mouse button. The 3 keys that you can use are m = meta, c = control, s = shift key. Context is where the pointer has to be for the function to take place. In this example, If I hit the Left Mouse button in the root window, it will bring up a menu called "defops". If I hold down the control key with the Middle Mouse button any where it will bring up a kill icon, which I can then kill any windows with it.
"Up" = c : all : f.scrollup
"Down" = c : all : f.scrolldown
"Left" = c : all : f.scrollleft
"Right" = c : all : f.scrollright
By using the cursor keys on the number pad, and the control key, one can scroll through the Virtual Desktop.
menu "Main Menu"
{
"Main Menu" f.title
"Rlogin" f.menu "Rlogin"
"New Window" !"xterm&"
"T window" !"xterm -fg yellow -bg DeepSkyBlue3 &"
"Lock Screen" !"xlock -mode flame -bg blue &"
"Exit" f.quit
}
menu "Rlogin"
{
"Rlogin" f.title
"Aludra" !"xrem aludra&"
"Alcor" !"xrem alcor&"
}
Here is a sample menu. You can add more sub menus with the function f.menu "name". In the example above, the main menu will have a
sub menu called "Rlogin" as the first selection. Remember that when you start to customize your menus, to always have a f.quit function to exit out of
windows, or you have to type $WINSYS_LIB/xexit at the Unix Prompt.
Xdefaults
The .Xdefaults file allows you to customize the behavior of applications by setting options in a "resource" database. The characteristics of an application are referred to as the resources of the application. Common resources include the foreground and background colors and font used by an application.The following is an example from a .Xdefaults file:
*Background: black
*Foreground: white
Xgopher*Background: wheat
Xgopher*Foreground: black
xterm*Background: grey
xterm*Foreground: maroon
xterm*font: 9x15
xterm*JumpScroll: on
xterm*SaveLines: 400
The general syntax used to define a resource is as follows:
program_name*resource_name: resource_value
In the previous example, the background and foreground colors for the programs Xgopher and xterm have been defined. The first lines which do not include a program name, indicate that the default color for any application which is not specified will be the colors specified there.
The list of available fonts can be viewed by using the command "xlsfonts". The list is quite long. You can view fonts by using
the "xfd" can be used to display a font. For example to display the font called "10x24", type:
xfd -fn 12x24
Documentation and Help
You may also find the following man pages of interest:
startwin
tvtwm
xview
You can read man pages by entering at your UNIX shell prompt:
man manpage_name
Last updated:
February 04, 2011