📄 0112-0114.html
字号:
<HTML>
<HEAD>
<TITLE>Sams Teach Yourself Linux in 24 Hours:Using the X Window System:EarthWeb Inc.-</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311623 //-->
<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->
<!-- AUTHOR=Bill Ball//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=07 //-->
<!-- PAGES=0103-0126 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="0108-0111.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0115-0117.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-112"><P>Page 112</P></A>
<UL>
<DL>standalone Linux X11 workstations</DL>
</UL>
<P>You'll find that rxvt supports at least one of the same command-line options as
nxterm—the -e option to run programs in a standalone X Window. The
-e option is useful if you want to run programs under X that are normally run from a non-graphical environment
(the console), for example:
</P>
<!-- CODE SNIP //-->
<PRE>
# rxvt -e pico &
</PRE>
<!-- END CODE SNIP //-->
<P>This command line will run the pico editor (part of the
pine mail program) in a standalone window. You can create, open, edit, and save files, but when you quit the
pico editor, the window will disappear. This is a great way to run interactive console programs under X.
</P>
<P>The rxvt client also supports a number of X Toolkit options, as you'll see in the next
section. By using these options, you can start your
rxvt terminal at any location of your desktop,
with any available font, and with a selection of foreground and background colors.
</P>
<H3><A NAME="ch07_ 11">
Learning X11 Basic Operations
</A></H3>
<P>A number of basic operations are important for you know about in using X11 and
X11 clients. Many programs accept similar command-line options, so you can customize
the size, color, and placement of client windows. This section introduces you to some of
the more common command-line options and shows you how to use them.
</P>
<TABLE BGCOLOR=#FFFF99>
<TR><TD>TIME SAVER</TD></TR>
<TR><TD>
<BLOCKQUOTE>
Not all X11 clients support the same X11 options, known as X
Toolkit command-line options. For a full discussion of these options, see the X
manual page, found under the /usr/X11/man/man1 directory, or an individual
client's manual page for details.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
<H4><A NAME="ch07_ 12">
Using X11 Client Geometry Settings
</A></H4>
<P>You can use the geometry option, usually in the form of
-geometry widthxheight+xoffset+yoffset, to manage how and where your client's window will be displayed.
</P>
<P>For example, if you want to start an rxvt terminal in the upper left corner of your
screen, you would use
</P>
<!-- CODE SNIP //-->
<PRE>
# rxvt -geometry 80x25+0+0 &
</PRE>
<!-- END CODE SNIP //-->
<P>This command starts an 80-character, 25-line
rxvt terminal, and places its window at the upper left corner of your display. Here's a neat trick: If you are using a
virtual-window-
</P>
<A NAME="PAGENUM-113"><P>Page 113</P></A>
<P>
capable window manager, and have several desktops available, you can start
terminal emulators not only in your current desktop, but also in other desktops.
</P>
<P>For example, if your current desktop is
800¥600, you can easily start other X11
clients in adjacent desktops by specifying the x and y offsets, as follows:
</P>
<!-- CODE SNIP //-->
<PRE>
# rxvt -geometry 80x25+801+0
# rxvt -geometry 80x25+0+601
</PRE>
<!-- END CODE SNIP //-->
<P>The first command line will start another terminal window, but at the upper left corner
of the desktop immediately to the right. The second command line starts another
terminal window, but at the upper left corner of the desktop immediately below. This is a
handy feature to use if you want to set up not only your desktops, but others before you start
X11. Using this approach, you can start word processing in one desktop, a Web browser
in another, and a graphics program in a third (assuming you have enough memory).
</P>
<P>The geometry specification is extremely useful for building organized, working
screens. You can also use the very convenient "save desktop" features of the
fvwm family of window managers to build your displays manually, and then save the window display settings to
a file to be later edited into your .xinitrc window initializer file.
</P>
<TABLE BGCOLOR=#FFFF99>
<TR><TD>TIME SAVER</TD></TR>
<TR><TD>
<BLOCKQUOTE>
The .xinitrc file usually resides in your home directory, and should be
copied from the system xinitrc file, found in the
/etc/X11/xinit directory.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
<H4><A NAME="ch07_ 13">
Setting Background and Foreground Colors for X11 Clients
</A></H4>
<P>You can also usually set background and foreground colors for different parts of your
X11 client's window with the -bg and -fg color command-line options. You'll find a list of
colors supported by the XFree86 X11 servers in the file
rgb.txt in the /usr/X11R6/lib/X11 directory. For example, to start the
rxvt terminal emulator with a red background with yellow text for
the foreground, you would use
</P>
<!-- CODE SNIP //-->
<PRE>
# rxvt -bg red -fg yellow
</PRE>
<!-- END CODE SNIP //-->
<P>If you're not using X11 in the 8bpp (8 bits per pixel) mode (256 colors) with
the XF86_SVGA server, you'll find a more limited selection of colors available. For
example, you'll only have 16 colors available if you use the XF86_VGA16 server, or only black
and white if you use the monochrome server, XF86_Mono. You might also try to see
the available colors by using the xcmap client, which displays the colors in a grid, and gives
the rgb (red, green, and blue) values of the color in base 16, or hexadecimal (see the X and
xcmap manual pages for more information). Another program to try is the
showrgb client, which will automatically list the contents of the rgb database,
rgb.txt.
</P>
<A NAME="PAGENUM-114"><P>Page 114</P></A>
<P>
Other color options can include -bd for color choices of window borders, or the
-rv and +rv reverse video modes, which are useful for monochrome displays.
</P>
<H4><A NAME="ch07_ 14">
Setting X11 Client Resources
</A></H4>
<P>The X Window System also supports further client configuration through the
use of client resources. These are nothing more than text files that contain settings for different
aspects of how a client looks or runs. You might also be able to set different resources of a
client program when it first starts by using the
-xrm command-line option to specify a resource string, but most programs will only use a resource file.
</P>
<P>In order to change resource settings, you need to know what resources an X11 client
uses. You can find this information by either reading the program's manual page, or looking
for any installed settings in a file with (but not always) the client's name in the
app-defaults directory under the
/usr/X11R6/lib/X11 directory, as follows:
</P>
<!-- CODE //-->
<PRE>
# ls -A /usr/X11R6/lib/X11/app-defaults
Beforelight RXvt* XGetfile XPlaycd Xgc
Bitmap Seyon XIdle XScreenSaver Xgopher
Bitmap-color Seyon-color XLoad XSm Xgopher-color
Chooser Viewres XLock XSysinfo Xloadimage
Editres X3270 XLogo XSysinfo-color Xmag
Editres-color XBanner XLogo-color XTerm Xman
Fig XCalc XMailbox XTerm-color Xmessage
Fig-color XCalc-color XMdb Xditview Xmh
GV XClipboard XMem Xditview-chrtr Xvidtune
GXditview XClock XMixer Xedit xosview
Ghostview XConsole XPaint Xfd
NXTerm XFontSel XPat Xfm
</PRE>
<!-- END CODE //-->
<P>You can see that there are quite a few files with application default settings, but that
not all of the more than 200 programs for X11 have settings installed. Each file
contains resource strings for a particular X11 client. The resource strings can provide not
only information that determines how a program is displayed, but the contents and handling
of menus, buttons, or other parts of a program.
</P>
<P>The format of resource strings is defined in the X manual page, but many X11 client
manual pages will list different resources, with examples, for a particular client. For example, if
you look at the resource settings for the xpaint drawing program's main toolbox, you'll
see the following values:
</P>
<!-- CODE //-->
<PRE>
...
!
! The top level operation/toolbox menu
!
XPaint.width: 232
XPaint.height: 350
...
</PRE>
<!-- END CODE //-->
<P><CENTER>
<a href="0108-0111.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0115-0117.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -