📄 145-148.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Configuration and Installation:Installing and Configuring XFree86</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=1558285660//-->
<!--TITLE=Linux Configuration and Installation//-->
<!--AUTHOR=Patrick Volkerding//-->
<!--AUTHOR=Kevin Reichard//-->
<!--AUTHOR=Eric Foster//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=3//-->
<!--PAGES=145-148//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="143-145.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="148-153.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>In our case, we use <B>xsetroot</B> to change the screen’s background color and then launch <B>oclock</B>, a rounded clock, the <B>fvwm</B> window manager, and two <B>xterms</B>. No matter what, you need a window manager program, to control the display. The default window manager on Linux is called <B>fvwm</B> (see Figure 3.1) and you’ll find it highly customizable.</P>
<P>X quits when the last program in the <B>.xinitrc</B> (system or local) stops. Often, this last program is preceded by an <B>exec</B> statement. When you quit this last program, X stops and you’re back at the console. In our case, we use <B>fvwm</B> as this last—key—process, because you need a window manager running during your entire X session, making <B>fvwm</B> a natural for this last process.</P>
<P>All our customizations to the <B>.xinitrc</B> file fit into a few simple lines:</P>
<!-- CODE SNIP //-->
<PRE>
# Start X applications
xsetroot -solid bisque3
/usr/bin/X11/oclock -geom 100x100+0+6 &
/usr/bin/X11/xterm -ls -geom 80x24+3+372 &
/usr/bin/X11/xterm -ls -geom 80x48+264+13 &
exec fvwm
</PRE>
<!-- END CODE SNIP //-->
<P>The full <B>.xinitrc</B> file will look something like the following:</P>
<!-- CODE //-->
<PRE>
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
# start some nice programs
xsetroot -solid SteelBlue
# Changed lines are below.
xterm -geom 80x32+264+0 -ls &
xterm -geom 80x32+0+250 -ls &
oclock -geom -7-7 &
exec fvwm
</PRE>
<!-- END CODE //-->
<P>If you don’t set up a <B>.xinitrc</B> file and there is no system one, the default behavior is to create a single <B>xterm</B> window in the top-left corner of the screen. This <B>xterm</B> then becomes the key process, even if you later launch a window manager. When this <B>xterm</B> exits, X exits.</P>
<P>Chances are you can start with the above file and customize it to your needs later.</P>
<P><FONT SIZE="+1"><B>Stopping X</B></FONT></P>
<P>To stop X in the no <B>.xinitrc</B> file configuration, you need to find the <B>xterm</B> window that started out in the upper-left corner (you might have moved it) and exit it. You’ll soon be out of X and back to the boring old terminal mode.</P>
<P>If you use a <B>.xinitrc</B> file, simply exit the window manager to exit X. Normally, you can exit the window manager from a menu called up by placing the mouse over an empty area of the screen and holding down the leftmost mouse button. If this doesn’t work, try any and all mouse buttons.</P>
<P><FONT SIZE="+1"><B>Tuning Your Modes</B></FONT></P>
<P>It’s likely that the default mode in the <B>XF86Config</B> file will specify a 640-by-480 resolution. Chances are your hardware supports much higher resolutions. While running X, you can press <B>Ctrl-Alt-Keypad-+</B> to switch to the next mode in the <B>XF86Config</B> file.</P>
<P>This is very useful, because the way X comes up may not look like a normal screen. If this is the case, try switching modes to see if things get better.</P>
<P>You can also change the <B>XF86Config</B> file to start up in the best mode. Look for the Screen section in your <B>XF86Config</B> file. You’ll want to change the modes line from something like:</P>
<!-- CODE SNIP //-->
<PRE>
Modes "640x480" "800x600" "1024x768"
</PRE>
<!-- END CODE SNIP //-->
<P>to
</P>
<!-- CODE SNIP //-->
<PRE>
Modes "1024x768" "800x600" "640x480"
</PRE>
<!-- END CODE SNIP //-->
<P>Note that we merely put the best mode first. This makes XFree86 start up in 1024-by-768-pixel-resolution mode, a much nicer display mode, especially for X. Before doing this, though, make sure that all graphics modes work by using <B>Ctrl-Alt-Keypad-+</B> while X is running. Ensure that each change results in a valid display.</P>
<H4 ALIGN="LEFT"><A NAME="Heading22"></A><FONT COLOR="#000077">VGA to the Rescue</FONT></H4>
<P>If all the preceding methods have failed, you may want to fall back on VGA, just to get X up and running. This is presuming, of course, that you don’t have a plain old Super VGA card, for which the Super VGA modes would be most appropriate. Instead, the theory is that if you can’t get your super-duper card to run X in its super-duper accelerated mode, maybe you can get it running in plain old VGA. Most PC graphics boards support the VGA modes, so this method, while it won’t take advantage of the power of your graphics card, may at least allow you to run X if you can’t so far.
</P>
<P>In the next section, we’ll show how to get a generic VGA file built. This step is usually much quicker than getting the file properly built for your graphics hardware.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>WARNING: </B>Setting up XFree86 incorrectly can harm your system hardware, so watch out.<HR></FONT>
</BLOCKQUOTE>
<H4 ALIGN="LEFT"><A NAME="Heading23"></A><FONT COLOR="#000077">Using the Default Super VGA</FONT></H4>
<P>In this section, we discuss using the sample Super VGA <B>XF86Config</B> file that comes with XFree86. You should always set up the <B>XF86Config</B> file for your exact hardware configuration. We only mention this technique because setting up X can prove to be nearly impossible. It is always best to set up X for your hardware. Remember, you were warned.</P>
<P>The first thing to do is find the example <B>XF86Config</B> file that comes with XFree86. This file, usually named <B>XF86Config.eg</B> and stored in <B>/usr/X11R6/lib/X11</B>, has the default mode for a 640-by-480-pixel Super VGA device. Most PC graphics boards support this mode, so you might be in luck.</P>
<P>Copy the <B>XF86Config.eg</B> file and edit it. You’ll need to add the data about your mouse and monitor. In fact, the more you can fill in, the better. When you’re done, you can copy this file to <B>XF86Config</B> and start up X. If you do use the Super VGA example file, you must use this X server. (Unless you have an Accel screen section set up, none of the accelerated X servers will work.)</P>
<P>Remember that running X this way may damage your hardware (don’t say we didn’t warn you). The only reason you want to run in a lower-resolution mode is if all else fails.</P>
<P>Again, it’s best to configure X for <I>your</I> hardware. Only try the Super VGA mode if you have a card for which all else fails (unless, of course, your graphics card is a Super VGA card and the <B>XF86_SVGA</B> program is the appropriate X server).</P>
<P>If you’re still having problems with X, you may want to look for extra help on the Internet.</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="143-145.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="148-153.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -