📄 ch22.htm
字号:
EndSubsection
EndSection
# The Mono server
Section "Screen"
Driver "vga2"
Device "Generic VGA"
Monitor "Generic Monitor"
Subsection "Display"
Modes "640x480"
ViewPort 0 0
Virtual 800 600
EndSubsection
EndSection
</FONT></PRE>
<P>The <TT>Modes</TT> line in a video section can have up to 10 values. Be very careful
when modifying these values because a wrong setting might wind up destroying your
monitor! It does not matter if these values are not present because defaults can
be used. This would be a typical line to override defaults for a monitor:</P>
<PRE><FONT COLOR="#0066FF">"640x400" 28 640 480 728 776 480 480 482 494
</FONT></PRE>
<P>The 10 values in order from left to right are shown in the following section.
These values make sense only to video engineers or those folks who have to work with
a monitor not defined in the default modes. Check your monitor's hardware specifications,
and get the values from there to fill in these 10 parameters. These are the fields
to set:
<UL>
<LI>The label for screen resolution; for example, 640x480 or 1024x768.
<P>
<LI>The clock frequency in MHz.
<P>
<LI>The Horizontal Display End in number of visible dots per line on the screen.
<P>
<LI>The Start Horizontal Retrace value. Specifies the number of pulses before the
video sync pulse starts.
<P>
<LI>The End Horizontal Retrace value. Defines the end of the sync pulse.
<P>
<LI>The Horizontal Total value. The total number of dots per line invisible and visible.
<P>
<LI>The Vertical Display End value. The number of visible lines on the screen.
<P>
<LI>The Start Vertical Retrace value. The number of lines before the sync pulse starts.
<P>
<LI>The End Vertical Retrace value. The number of lines at the end of the sync pulse.
<P>
<LI>The Vertical Total value. The total number of lines, invisible plus visible,
on the screen.
</UL>
<P>Multiscan monitors handle frequencies of 15 to 40 MHz. Some monitors work at a
72 MHz vertical scan to prevent the flicker. You have to be able to calculate the
frequency from the monitor's specification and come up with these numbers. A good
place to start would be the <TT>XFree86-HOWTO</TT> document on how to get these values.
Keep in mind that your video monitor is just a glorified television. You give it
wrong values, and you can fry it.
<H4 ALIGN="CENTER"><A NAME="Heading22<FONT COLOR="#000077">International Keyboard
Layout for XFree86</FONT></H4>
<P>XFree86 servers are able to read the key table from the Linux kernel, so you need
to set up only one keyboard layout file (for the kernel). There are some restrictions,
though; the kernel can support more keyboard functions than X11. X11 can modify only
one of the four key tables. This modifier is called <TT>ModeShift</TT>.</P>
<P>Configurable keys for the <TT>ModeShift</TT> modifier are LeftAlt, RightAlt (sometimes
referred to as AltGr), RightCtl, and ScrollLock.</P>
<P>Usually, the AltGr key is used for international keyboard modifications. To enable
the XFree86 server to read the RightAlt key table from the kernel, you should put
the following line in the <TT>.xinitrc</TT> file:</P>
<PRE><FONT COLOR="#0066FF">RightAlt "ModeShift"
</FONT></PRE>
<P>Besides supporting only one additional key map, X11 cannot use dead keys. A key
is called dead if, when it is typed, it does not print a character until a second
character is typed. A typical example is an accent key. Such keys are not supported
by X11, so you need to replace all dead key symbols with non-dead equivalents. Table
22.1 lists what you have to change. </P>
<CENTER>
<P><FONT SIZE="4"><B>Table 22.1. Key symbols. </B></FONT>
<TABLE BORDER="0">
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="146" ALIGN="LEFT"><I>Dead</I></TD>
<TD ALIGN="LEFT"><I>Non-Dead</I></TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="146" ALIGN="LEFT"><TT>dead_tilde</TT></TD>
<TD ALIGN="LEFT">ASCII tilde</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="146" ALIGN="LEFT"><TT>dead_grave</TT></TD>
<TD ALIGN="LEFT">grave</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="146" ALIGN="LEFT"><TT>dead_circumflex</TT></TD>
<TD ALIGN="LEFT">ASCII circum</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="146" ALIGN="LEFT"><TT>dead_acute</TT></TD>
<TD ALIGN="LEFT">apostrophe</TD>
</TR>
<TR ALIGN="LEFT" rowspan="1">
<TD WIDTH="146" ALIGN="LEFT"><TT>dead_diaeresis</TT></TD>
<TD ALIGN="LEFT">dieresis</TD>
</TR>
</TABLE>
</P>
</CENTER>
<P>Instead of supporting dead keys, XFree86 supports a Compose key. This feature
is described in the <TT>XFree86kbd</TT> man page. You can modify this feature by
assigning the <TT>Compose</TT> function to one of the keys. By default, the ScrollLock
key has the <TT>Compose</TT> function.</P>
<P>If you still want to have the dead keys on the console, you must use an <TT>xmodmap</TT>
file to map the keys to the correct symbols under X. This is also the method that
must be used with earlier versions of XFree86. On <TT>sunsite</TT> in the directory
<TT>/pub/Linux/X11/misc</TT>, you can find sample <TT>xmodmap</TT> files for several
languages. Note that you have to set the <TT>ModeShift</TT> modifier to get the right
key table working.</P>
<P>Read the <TT>kbd.FAQ</TT> that comes with the <TT>kbd</TT> package for Linux.
You will find many hints for modifying your keyboard layout on the console, as well
as for X.
<CENTER>
<H3><A NAME="Heading23<FONT COLOR="#000077">The .xinitrc File</FONT></H3>
</CENTER>
<P>To use X, you need a startup file that calls the local modifications, the window
manager, and an application you want to use right after X has started. If you are
using <TT>startx</TT> (or <TT>runx</TT>) to start X, this startup file is called
<TT>xinitrc</TT>. There is a standard <TT>xinitrc</TT> file, <TT>/usr/lib/X11/xinit/xinitrc</TT>,
which is the traditional location for this file. The Linux file system standard in
<TT>setup</TT> places this file in <TT>/etc/X11/xinit/xinitrc</TT> to allow a read-only
mounted <TT>/usr</TT> partition, so look at that location first.</P>
<P>If you are not content with what this file does (for instance, if you want to
use a different window manager), you should copy it to the file <TT>.xinitrc</TT>
in your <TT>home</TT> directory. After copying the file, you can edit it. Look at
the man pages for <TT>startx</TT> and <TT>xinit</TT> for more information.</P>
<P>Note that both the <TT>.xinitrc</TT> and the <TT>.Xresources</TT> files must be
readable and executable, so run the following command on these files after editing
them. You have to run the <TT>chmod</TT> command only once on the application.</P>
<PRE><FONT COLOR="#0066FF">$ chmod u+rx .xinitrc .Xresources
</FONT></PRE>
<P>This command makes these files executable.</P>
<P>Listing 22.6 shows a sample <TT>xinitrc</TT> file.
<CENTER>
<H3><A NAME="Heading24<FONT COLOR="#000077">Listing 22.6. A sample .xinitrc
file.</FONT></H3>
</CENTER>
<PRE><FONT COLOR="#0066FF">
1 #!/bin/sh
2 # $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
3 # modified by obz
4 userresources=$HOME/.Xresources
5 usermodmap=$HOME/.Xmodmap
6 sysresources=/usr/lib/X11/xinit/.Xresources
7 sysmodmap=/usr/lib/X11/xinit/.Xmodmap
8 # merge in defaults and keymaps
9 if [ -f $sysresources ]; then
10 xrdb -merge $sysresources
11 fi
12 if [ -f $sysmodmap ]; then
13 xmodmap $sysmodmap
14 fi
15 if [ -f $userresources ]; then
16 xrdb -merge $userresources
17 fi
18 if [ -f $usermodmap ]; then
19 xmodmap $usermodmap
20 fi
21 # Set the background to a dull gray
22 if [ -f /usr/bin/X11/xsetroot ]; then
23 xsetroot -solid gray32
24 fi
25 if [ -f /usr/bin/X11/xclock ]; then
26 xclock -geometry 80x80 &
27 fi
28 olvwm &
29 # fvwm &
30 xterm -e /bin/bash
</FONT></PRE>
<P>The line numbers in this listing have been added for your benefit. Let's look
at these lines in greater detail.</P>
<P>Lines 4-7 set the resource environment variables for the X Window installation
for your system. Change these to the path of your system's X Window system distribution.</P>
<P>Lines 9-20 check for the existence of these resources and then run the appropriate
program, xmodmap or xrdb, with these resources as parameters. I cover both xmodmap
and xrdb in Chapter 23, "Using Motif." For now, you can use this the way
it stands.</P>
<P>Lines 22-24 check for the xsetroot program. If it's present, these lines execute
it to set the background to a solid color, <TT>gray32</TT>.</P>
<P>The <TT>olvwm &</TT> command in line 28 starts the OPEN LOOK window manager.
If you want to use <TT>fvwm</TT> instead of <TT>olvwm</TT>, uncomment line 29 and
comment line 28 instead. The window manager must be run in the background if you
have more commands following this one.</P>
<P>Line 30 starts a terminal to work with. Because this is the last line in the <TT>.xinitrc</TT>
file, exiting this terminal causes your X session to stop. If you want to start more
<TT>xterms</TT>, you can start them from within this <TT>xterm</TT>.</P>
<P>A simpler <TT>.xinitrc</TT> file to start with would be this:</P>
<PRE><FONT COLOR="#0066FF">xterm -name Console &
olvwm
</FONT></PRE>
<P>You can then enhance this <TT>.xinitrc</TT> file with what you want.
<CENTER>
<H3><A NAME="Heading25<FONT COLOR="#000077">The Personal X Resource File</FONT></H3>
</CENTER>
<P>Sometimes you won't be content with default settings for applications that don't
have a configuration file of their own. You can change some of these defaults by
setting X resources in the <TT>.Xresources</TT> file in your <TT>home</TT> directory.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading26<FONT COLOR="#000077"><B>NOTE: </B></FONT>You should know
what effects setting the resources will have on the programs you use. Read the man
pages for the program and for xrdb before editing the <TT>Xresources</TT> file. See
Chapter 2, "Types of Linux," and Chapter 25, "Ghostscript," for
more information about X resources.
<HR>
</DL>
<P>A resource file looks like an application default file. The difference is that
in the resource file, resources for several applications are set. You should use
the full names (Progname.Resourcename) instead of abbreviating the program name with
an asterisk. Examples of application default files can be found in the <TT>/usr/X386/lib/X11/app-defaults</TT>
directory. The resources available for a single application are usually shown in
the man pages for that application.</P>
<P>If you are running a color server, you might want to put the following lines into
your <TT>.Xresources</TT> file if some programs start in black and white:</P>
<PRE><FONT COLOR="#0066FF">#ifdef COLOR
*customization: -color
#endif
</FONT></PRE>
<P>If this change is made, the program Foo will read both the Foo and the Foo-color
application default file from <TT>/usr/X386/lib/X11/app-defaults</TT>. The usual
behavior is for Foo only to be read.
<DL>
<DT></DT>
</DL>
<DL>
<DD><A NAME="Heading27
<HR>
<FONT COLOR="#000077"><B>NOTE:</B> </FONT>If you are running a color server, the
preceding code definitely should be added to the system <TT>Xresources</TT> file.
You might mention that to whomever maintains the program you are running.
<HR>
</DL>
<P>Note that the black-and-white color scheme of a program might be caused by the
program rather than its resources.</P>
<P>The <TT>-xrm</TT> can be used with most X programs to override the parameters
set in your .<TT>Xresources</TT> file. The usage is</P>
<PRE><FONT COLOR="#0066FF">-xrm "resource"
</FONT></PRE>
<P>Alternatively, you can use the <TT>xrdb</TT> filename command to make any changes
you have made in filename apply to your current session.
<CENTER>
<H3><A NAME="Heading28<FONT COLOR="#000077">Using xdm</FONT></H3>
</CENTER>
<P>If you want to run X on your system all the time, you could run xdm from the system
startup. xdm is preconfigured on most systems, so you should not have to edit any
of the xdm configuration files. You can run xdm from the command line at the console
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -