Command Line Options
adam allows the drug user to specify numerous ( very numerous ! ) command line options when starting most clients. The dominate line options for each node are detailed on the reference pages in Part Three of this usher .
As a general rule, all options can be shortened to the shortest alone abbreviation. For example,
-display can be shortened to
-d if there is no early choice beginning with “ d. ” ( Note that while this is true for all the standard MIT clients, it may not be true of any random client taken off the net. )
In addition to sealed client-specific options, all applications built with the X Toolkit accept certain standard options, which are listed in table 8-1. ( Some non-Toolkit applications may besides recognize these options. ) The first column gives the name of the option, the second the identify of the resource to which it corresponds ( see Chapter 9, Setting Resources ), and the third gear a brief description of what the option does. This chapter discusses some of the more normally used Toolkit options and demonstrates how to use them. ( For the syntax of the other Toolkit options, see the X reference book page in Part Three of this guide. )
-xnllanguage are available as of Release 4 .
Table 8-1. Standard Options
Though all Toolkit options are preceded by a subtraction sign of the zodiac, client-specific options may or may not require it. See the reference page for each client in Part Three of this guide for the syntax of all options .
Which Display to Run On
by and large, the results of a client program are displayed on the system where the customer is running. however, if you are running a client on a distant system, you probably want to display the results on your local anesthetic server .
An option of the form :
-display [host] : server[.screen]
can be used to tell a node which server to display results on .
host specifies on which machine to create the windowpane, the
server specifies the server issue, and the
screen specifies the screen act. Note that the
server parameter constantly begins with a colon ( a double colon after a DECnet node * ), and that the screen argument always begins with a period. If the host is omitted or is specified as
unix, the local node is assumed. If the screen is omitted, shield 0 is assumed .
xterm and other x clients normally get the host, server, and shield from the DISPLAY environment variable. ( In most configurations, DISPLAY will be set to the local anesthetic host, server 0 and screen 0. )
however, you may want to specify the horde, server, and shield explicitly. You can do this for all clients by resetting the value of the DISPLAY variable star, or for a unmarried invocation of a client by using the
-display option .
For model :
% xterm -display other_node: 0.0 &
creates an xterm window on sieve 0 of waiter 0 on the car named
Although a lot of the stream X Window System software documentation suggests that any of the parameters to the
-display choice can be omitted and will default to the local node, server and screen door 0, respectively, we have not found this to be true. In our experience, merely the
screen parameters ( and the menstruation preceding
screen ) can be omitted. The colon and
server are necessity in all circumstances .
-display choice can be abbreviated as
Title and Name
The name of the program ( as known to the server ) and the title of the windowpane can be specified on the command line. The
-title option allows you to specify a text string as the title of the application ’ s window. If your lotion has a titlebar, or if the window director you are using puts titlebars on windows, this drawstring will appear in the titlebar. Window titles can be utilitarian in distinguishing multiple instances of the like application .
-name option actually changes the name by which the server identifies the program. Changing the name of the lotion itself ( with the
-name option ) affects the manner the application interprets resource files. This choice is discussed further in chapter 9, Setting Resources. If a appoint string is defined for an application, that string will appear as the application name in its picture .
If you display data about presently running windows using the xwininfo or xlswins customer, title strings will appear in parentheses after the associated window ID numbers. ( If there is no title string, but there is a name string, the name string will be displayed. )
You can besides use the xwininfo client to request information about a particular window by championship, or name, if no title string is defined, using that application ’ s own
-name option. See the xlswins and xwininfo reference point pages in Part Three and the part “ Window and Display Information Clients ” in Chapter 7, Other Clients, to learn more about these clients .
All clients that display in a window take a geometry option that specifies the size and location of the node window. The syntax of the geometry option is :
-geometry option can be ( and frequently is ) abbreviated to
-g, unless there is a conflicting option that begins with “ thousand. ”
The parameter to the geometry option (
geometry ), referred to as a “ standard geometry string, ” has the shape :
width, height, xoff ( x cancel ), and
yoff ( y offset ) are values in pixels for many clients. however, application developers are encouraged to use units that are meaningful to the lotion. For case, xterm uses columns and rows of text as width and height values in the xterm window .
You can specify any or all elements of the geometry string. Incomplete geometry specifications are compared to the resource director defaults and missing elements are supplied by the values specified there. If no default is specified there, and twm is running, the window director will require you to place the window interactively .
The values for the adam and y offsets and their effects are shown in table 8-2 .
Table 8-2. Geometry specification x and y offsets
For exercise, the command line :
% xclock -geometry 125x125-10+10 &
places a clock 125×125 pixels in the upper-right corner of the display, 10 pixels from both the exceed and right edge of the screen .
For xterm, the size of the window is measured in characters and lines. ( The default option size is 80 characters wide by 24 lines long. ) If you wanted to use a boastfully VT100 window, 120 characters wide by 40 lines long, you could use the adopt geometry specification :
% xterm -geometry 120x40-10+350 &
This command places the boastfully xterm window in the lower-right comer, 10 pixels from the right boundary of the screen and 350 pixels from the lead of the screen. Figure 8-1 illustrates window offsets .
Figure 8-1. Window offsets
several clients, including xterm, allow you to set the size and side of the icon or alternative window using resource variables ( in an .Xdefaults or other resource charge ). See the allow client reference pages in Part Three of this lead for a accomplished list of available resources. Refer to Chapter 9, Setting Resources, for instructions on how to set resources .
You should be mindful that, as with all user preferences, you may not constantly get precisely what you ask for. Clients are designed to work with a windowpane director, which may have its own rules for window or icon size and placement. however, precedence is always given to specific exploiter requests, so you won ’ t frequently be surprised .
many clients besides allow you to specify the width of the frame to be placed around the window. The frame width is specified in pixels. For exercise :
% xterm -bw 10 &
sets a border of 10 pixels around the xterm window .
You will have to experiment to get a feel for the transformation between the number of pixels and actual sizes and distances. It will vary, depending on the type of workstation you are using .
If you are experimenting with geometry measurements, use the xwininfo client to display information about windows on the blind .
At the instruction line prompt in an xterm window, type :
and then click on the window for which you want to display information. You should see a expose which gives respective characteristics about the window in interrogate. The statistics most relevant to window geometry are listed below, with some typical readings :
Upper left X: 572
Upper left Y: 582
Border width: 1
Corners: +572+582 -0+582 -0-0 +572-0
All numeric information is in pixels, except depth, which is in bits per pixel. ( See the discussion of tinge by and by in this chapter for the significance of window depth. ) The upper exit X and Y coordinates are peculiarly useful for setting the location of a window using the geometry option. Upper left X corresponds to the convinced ten offset (
+xoff ) and amphetamine left Y corresponds to the positive y counterbalance (
+yoff ) .
The four comers are listed with the upper left comer first and the other three clockwise around the window ( i.e., upper right, lower right, lower left ). The upper left arrival ( first in the list ) constantly gives the positive ten and yttrium offsets for the window. In other words, the upper berth left comer specification is the
+xoff+yoff part of the geometry string .
The width and height in pixels are slightly less useful, since the geometry choice to xterm requires that these figures be specified in characters and lines. The readings above are for a standard size xterm window using a 12 point Roman Courier baptismal font. however, you will undoubtedly become accustomed to thinking in terms of pixels by specifying the geometry of other clients .
See the xwininfo address page in Part Three and the section “ Window and Display Information Clients ” in Chapter 7, Other Clients, for more details .
many clients have options that allow you to specify the color of the window surround, background, and foreground ( the color textbook or graphic elements will be displayed in ). These options generally have the shape :
-bg color Sets the background color .
-fg color Sets the foreground color .
-bd color Sets the border coloring material .
By default, the background of an application window is normally white and the foreground total darkness, even on color workstations. You can specify a newly color using either the color name listed in a system file called rgb.txt or hexadecimal values representing colors .
In the future section, we ’ ll take a expect at some of the colors available in the rgb.txt file. For now, let ’ s consider the syntax of a command telephone line specifying an xterm to be displayed in three colors :
% xterm -bg lightblue -fg darkslategrey -bd plum &
This command creates an xterm window with a background of idle blue, foreground of dark slate grey, and window surround of plum ( all colors are available in both Releases 3 and 4 ) .
At the control line, a color list should be typed as a single son ( for example,
darkslategrey ). however, you can type the words comprising a tinge name individually if you enclose them in quotes, as in the comply command line :
% xterm -bg "light blue" -fg "dark slate grey" -bd plum &
As we ’ ll understand, the rgb.txt file contains variants of the same color name ( for example, “ navy blue sky ” and “ NavyBlue, ” or “ grey ” and “ grey ” ) to allow a range of spell, space, and capitalization on the command trace .
Some clients allow extra options to specify color for other elements, such as the cursor, highlight, and so on. See the allow customer reference pages in Part Three of this lead for details .
The rgb.txt File
The rgb.txt file, normally located in /usr/lib/X11, is supplied with the criterion distribution of X and consists of predefined colors assigned to specific text names .
A corresponding compiled file called rgb.dir contains the definitions used by the server ; this machine-readable file serves as a color name database, and is discussed more in full in Appendix A, System Management. The rgb.txt file is the human-readable equivalent .
Release 4 Color Names
The nonpayment rgb.txt file shipped with Release 4 of adam contains 738 coloring material diagnose definitions. This phone number is slenderly deceptive, since as we ’ ve said, a number of the discolor names are merely variants of another color name ( differing only in spelling, spacing and capitalization ) .
still, the number of colors available in Release 4 is more than duplicate the number available in Release 3. Some of the Release 4 colors are entirely newfangled ( like bamboozle and brumous rose ), but many are equitable slightly different shades of colors available in prior releases .
For exemplar, the Release 3 rgb.txt file includes the color sea k. The Release 4 rgb.txt file offers the following shades of that color :
light sea green
medium sea green
dark sea green
Each of these names corresponds to a color definition. ( This list does not include the variants SeaGreen, LightSeaGreen, MediumSeaGreen, and DarkSeaGreen, which besides appear in the file. ) As you can see, some of these shades are distinguished in the fairly traditional direction of being called “ light, ” “ culture medium, ” and “ dark. ” The unaccented, culture medium, and black shades of a discolor can probably be distinguished from one another on about any monitor .
Beyond this eminence, there are what might be termed “ sub-shades ; ” gradations of a especial shade identified by number ( SeaGreen1, SeaGreen2, and so forth ). numerically adjacent subshades of a color may not be clearly distinguishable on all monitors. For example, SeaGreen1 and 2 may look identical much the lapp. ( You surely would not choose to create a window with a SeaGreen1 background and SeaGreen2 foreground ! On the other hand, subshades a couple of numbers apart are credibly sufficiently different to be used on the same window. )
By supplying many different shades of a single, already fairly accurate color like sea green, x developers have tried to provide definitions that work well on a variety of commonly-used monitors. * You may have to experiment to determine which colors ( or shades ) display best on your monitor .
The color names in the Release 4 rgb.txt file are besides numerous to list here. Although there are no literal dividers within the file, it can approximately be considered to fall into three sections :
|Section 1:||A standard spectrum of colors, many available in or similar to colors in Release 3 (such as sea green). These colors seem to be ordered roughly as follows: off-whites and other pale colors, greys, blues, greens, yellows, browns, oranges, pinks, reds, and purples.|
|Section 2:||Sub-shades of Section 1 colors (such as SeaGreen 1 through 4). These sub-shades comprise the largest part of the file.|
|Section 3:||One hundred and one additional shades of grey, numbered 0 through 100 (also available in Release 3). This large number of precisely graduated greys provides a wide variety of shading for monochrome screens.|
preferably than list every coloring material in the rgb.txt file, we ’ ve compiled the following table of representative colors. We ’ ve chosen some of the more esoteric color names. naturally, all of the primary coil and secondary colors are available besides .
grey0 (gray0) through
If you want to look more closely at the rgb.txt charge, you can open it with any textbook editor. As an alternative, you can besides display the contents of the file using the showrgb customer. showrgb seems to do nothing more than cat ( 1 ) the file to your terminal windowpane. Given the size of the charge, it ’ mho necessary to pipe the command ’ south output to a pagination broadcast, such as pg ( 1 ) or more ( 1 ) .
% showrgb | more
See Appendix A, System Management, for information on customizing color name definitions .
Release 3 Color Names
The follow are the default option color names shipped with Release 3 of the X Window System. Again, this list does not include the many variants of these names .
Alternative Release 4 Color Databases
In summation to the standard tinge database described above, Release 4 besides includes three other databases that can be compiled by your system administrator. These files can be found in the general acquittance in the directory ./rgb/others.
|raveling.txt||Designed by Paul Raveling, this database rivals the default database in size and scope, but has been tuned to display optimally on Hewlett-Packard monitors.|
|thomas.txt||Based on the Release 3 database, this file has been modified by John Thomas of Tektronix to approximate the colors in a box of Crayola Crayons.|
|old-rgb.txt||This is nothing more than the Release 3 database.|
Hexadecimal Color Specification
You can besides specify colors more precisely using a hexadecimal color string. You probably won ’ t function this method acting unless you require a color not available by using a color diagnose. In order to understand how this works, you may need a little background on how color is implemented on most workstations .
The RGB Color Model
Most coloring material displays on the marketplace today are based on the RGB semblance model. Each pixel on the blind is actually made up of three phosphors : one bolshevik, one k, and one blue. Each of these three phosphors is excited by a freestanding electron glow. When all three phosphors are in full illuminated, the pixel appears white to the human eye. When all three are blue, the pixel appears black. When the clarification of each primary color varies, the three phosphors generate a subtractive color. For example, equal portions of red and park, with no admixture of blue, makes chicken .
As you might guess, the saturation of each elementary color is controlled by a three-part digital value—and it is the claim constitution of this value that the hexadecimal stipulation allows you to set .
Depending on the underlying hardware, unlike servers may use a larger or smaller number of bits ( from 4 to 16 bits ) to describe the volume of each primary. To insulate you from this variation, most clients are designed to take color values containing anywhere from 4 to 16 bits ( 1 to 4 hexadecimal digits ), and the server then scales them to the hardware. As a leave, you can specify hexadecimal values in any one of the follow formats :
where R, G, and B represent single hexadecimal digits and determine the intensity of the bolshevik, green, and blue primaries that make up each tinge .
When fewer than four digits are used, they represent the most significant bits of the value. For example, # 3a6 is the lapp as # 3000a0006000. *
What this means concretely is possibly best illustrated by looking at the values that correspond to some colors in the color name database. We ’ ll use 8-bit values—two hexadecimal digits for each primary. The follow definitions are the hexadecimal equivalents of the decimal fraction values for some of the colors found in the rgb.txt file :
#5F9EA0 cadet blue
#6495ED cornflower blue
#ADD8E6 light blue
#B0C4DE light steel blue
#0000CD medium blue
#000080 navy blue
#87CEED sky blue
#6A5ACE slate blue
#4682B4 steel blue
As you can see from the colors given above, arrant red, green, and blue solution from the corresponding bits being turned full on. All primaries off yields black, while all closely full on gives white. Yellow, cyan, and magenta can be created by pairing two of the early primaries at wide volume. The assorted shades of gloomy shown above are created by varying the saturation of each primary—sometimes in unexpected ways .
The bottom agate line hera is that if you don ’ thyroxine closely know the physics of color, the best you can do is to look up existing colors from the tinge list database and experiment with them by varying one or more of the primaries till you find a color you like. Unless you need accurate colors, you are credibly better off using color names .
How Many Colors are Available?
The number of distinct colors available on the sieve at any one time depends on the sum of memory available for color stipulation. ( The xdpyinfo client provides information about a display, including the phone number of colors available at one time. See chapter 7, Other Clients, and the xdpyinfo reference page in Part Three for details. )
A discolor display uses multiple bits per pixel ( besides referred to as multiple planes or the depth of the display ) to select colors. Programs that draw in color use the prize of these bits as a arrow to a search table called a colormap, in which each entry ( or colorcell) contains the RGB values for a detail color. * As shown in Figure 8-2, any given pixel value is used as an index into this table—for example, a pixel value of 16 will select the sixteenth colorcell .
Why is this technical detail significant ? Because it explains several issues that you might encounter in working with color displays .
first, the scope of colors possible on the display is a function of the number of bits available in the colormap for RGB specification. If eight bits is available for each elementary, then the roll of possible colors is 2563 ( somewhere over 16 million colors ). This means that you can create fabulously accurate differences between colors .
however, the phone number of different colors that can be displayed on the riddle at any one time is a function of the number of planes. A four-plane system can index 24 colorcells ( 16 distinct colors ) ; an eight-plane system can index 28 colorcells ( 256 distinct colors ) ; and a 24-plane system can index 224 colorcells ( over 16 million clear-cut colors ) .
If you are using a four-plane workstation, the fact that you can precisely define hundreds of different shades of bluing is far less meaning than the fact that you can ’ metric ton use them all at the lapp time. There international relations and security network ’ triiodothyronine space for all of them to be stored in the colormap at one time, or any mechanism for them to be selected even if they could be stored .
Figure 8-2. Multiple planes used to index a colormap
This limitation is made more meaning by the fact that X is a multi-client environment. When adam starts up, normally no colors are loaded into the colormap. As clients are invoked, certain of these cells are allocated. But when all of the rid colorcells are used up, it is nobelium longer potential to request new colors. When this happens, you will normally be given the closest potential color from those that have already been allocated. however, you may alternatively be given an error message and told that there are no complimentary colorcells .
In order to minimize the probability of running out of colorcells, many programs use “ shared ” colorcells. Shared colorcells can be used by any number of applications, but they can ’ deoxythymidine monophosphate be changed by any of them. They can only be deallocated by each application that uses them, and when all applications have deallocated the cell, it is available for setting one again. Shared cells are most much used for backdrop, border, and cursor colors .
alternately, some clients have to be able to change the color of graphics they have already drawn. This requires another kind of cell, called individual, which can ’ thyroxine be shared. A distinctive use of a private cell would be for the pallete of a color mixing application. Such a platform might have three bars of each primary semblance, and a box which shows the blend color. The primary bars would use share cells, while the interracial discolor box would use a individual cell .
In drumhead, some programs define colorcells to be read-only and shareable, while others define colorcells to be read/write and secret .
To top it off, there are even clients that may temporarily swap in a whole secret colormap of their own. Because of the way discolor is implemented, if this happens, all early applications will be displayed in unexpected colors .
In orderliness to minimize such conflicts, you should request accurate colors merely when necessity. By predilection, use color names or hexadecimal specifications that you specified for other applications .
Starting a Client Window as an Icon
-iconic command line choice starts the customer window in iconified shape. To start an xterm window as an icon, character :
% xterm -iconic &
This can be specially useful for starting the login xterm window. As described in chapter 2, Getting Started, terminating the login xterm windowpane kills the X server and all early clients that are running. It ’ mho always potential to terminate a window unwittingly, by selecting the wrong menu choice or typing the wrong identify sequence. If your login xterm window is automatically iconified at startup, you are far less likely to terminate the windowpane unwittingly and end your x session .
For most clients, the size and position of the picture can be set using resource variables in an .Xdefaults or early resource file. ( This is highly recommend if you are starting the login xterm window as an icon. ) See the appropriate node reference pages in Part Three for a accomplished list of available resources. Refer to Chapter 9, Setting Resources, for instructions on how to set resources .
Specifying Fonts on the Command Line
many clients allow you to specify the font to be used when displaying textbook in the window. ( These are known as screen fonts and are not to be confused with printer fonts. ) For clients written with the X Toolkit, the option to set the display font is
-fn. For example, the instruction note :
% xterm -fn fontname &
creates an xterm window in which text will be displayed with the baptismal font named
chapter 5, Font Specification, describes the available filmdom fonts and baptismal font name conventions.
There are three options to control whether or not the application will display in reverse video—that is, with the foreground and backdrop colors reversed. The
-reverse choice is used to request rearward video recording .
+rv option is used to override any change by reversal video request that might be specified in a resource file ( see Chapter 9, Setting Resources ). This is crucial, because not all clients handle reverse video correctly, and flush those that do normally do indeed alone on black and white displays .