📄 ch22.htm
字号:
Popup "Modules" Module-Popup
Nop ""
Popup "Exit Fvwm" Quit-Verify
Nop ""
Refresh "Refresh Screen"
EndPopup
</FONT></PRE>
<P>Of course, menu items don't always have to do something for them to work. The
<TT>Nop</TT> command does "no operation." See the code in Listing 22.9
for the way fvwm quits back to a shell prompt. If the user selects the entry with
the title No, Don't Quit, no action is taken.
<CENTER>
<H3><A NAME="Heading40<FONT COLOR="#000077">Listing 22.9. Verify that the user
wants to quit.</FONT></H3>
</CENTER>
<PRE><FONT COLOR="#0066FF">
Popup "Quit-Verify"
Title "Really Quit Fvwm?"
Quit "Yes, Bail me outta here "
Restart "Restart Fvwm" fvwm
Restart "Start twm" twm
Restart "Start tvtwm" tvtwm
Restart "Start mwm" mwm
Restart "Start olvwm" /usr/openwin/bin/olvwm
Restart "Start olwm" /usr/openwin/bin/olwm
Nop ""
Nop "No, Don't Quit"
EndPopup
</FONT></PRE>
<P>One more thing. To get a horizontal bar in the menu entries, use the <TT>Nop</TT>
command with an empty string (<TT>""</TT>). If you place a space in the
string (<TT>" ")</TT> an empty box is created instead. By using these two
alternatives, you can create pretty decent separators for menu items.
<CENTER>
<H4><A NAME="Heading41<FONT COLOR="#000077">Startup</FONT></H4>
</CENTER>
<P>The <TT>InitFunction</TT> function in fvwm is the routine that is called by fvwm
when it initializes itself. The use of the <TT>InitFunction</TT> in fvwm is analogous
to that of the <TT>.xinitrc</TT> file in xinit: all startup components and modules
are loaded with this function in fvwm. The default entry for fvwm is shown in Listing
22.10. You can uncomment each line to enable it.
<CENTER>
<H3><A NAME="Heading42<FONT COLOR="#000077">Listing 22.10. The default InitFunction.</FONT></H3>
</CENTER>
<PRE><FONT COLOR="#0066FF">
Function "InitFunction"
# Module "I" FvwmBanner
# Exec "I" xpmroot /usr/include/X11/pixmaps/fvwm.xpm &
# Module "I" GoodStuff
# Module "I" FvwmPager 0 3
# Exec "I" exec xterm -geometry 80x64+0+0 &
# Wait "I" xterm
# Desk "I" 0 2
# Exec "I" exec xmh -font fixed -geometry 507x750+0+0 &
# Wait "I" xmh
# Desk "I" 0 0
EndFunction
</FONT></PRE>
<P>Each entry in the <TT>InitFunction</TT> generally consists of two lines. The second
line, if present, is a <TT>Wait</TT> function call. For example, a two-line entry
(often referred to as a "stanza") takes the following form:</P>
<PRE><FONT COLOR="#0066FF">
Exec "I" exec command options &
Wait "I" command
</FONT></PRE>
<P>The <TT>Wait</TT> command tells fvwm to wait until the command window is visible.
The <TT>Desk</TT> command forces fvwm to switch to a particular window on a desk.
By default, six virtual windows are available per desktop--two rows with three columns.
The <TT>Desk</TT> entry takes the desk and window of the virtual desktop to switch
to. The following lines fire up Netscape for me on the third window on desk 0 and
then switch back to the first desktop (desk 0, window 0) after the Netscape application
is visible. (See Chapter 61, "Using Browsers," for information on how to
get Netscape for Linux.)</P>
<PRE><FONT COLOR="#0066FF">
Desk "I" 0 2
Exec "I" exec netscape &
Wait "I" netscape
Desk "I" 0 0
</FONT></PRE>
<P>The <TT>Wait</TT> command is not necessary if all your initial programs are executed
on one window. The <TT>Wait</TT> command is required to force fvwm to wait for a
window to become fully visible on a desktop before switching to another desktop.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading43<FONT COLOR="#000077"><B>TIP:</B> </FONT>The <TT>Exec</TT>,
<TT>Wait</TT>, <TT>Desk</TT>, and <TT>Module</TT> commands require the <TT>"I"</TT>
string as the first parameter for fvwm to work correctly.
<HR>
</DL>
<CENTER>
<H4><A NAME="Heading44<FONT COLOR="#000077">Modules</FONT></H4>
</CENTER>
<P>A module is something that communicates with fvwm directly via pipes. Modules
cannot be executed directly and must be started from within fvwm. This lets fvwm
create bidirectional communication through the use of a UNIX pipe mechanism. Modules
enhance the functionality of fvwm.</P>
<P>The FvwmWinList opens a window with the list of all windows available to you on
a screen. Figure 22.1 shows the windows listed on my desktop.
<H6></H6>
<P><A NAME="Heading45<A HREF="../art/22/2201.jpg"><FONT COLOR="#000077">FIGURE
22.1.</FONT></A><FONT COLOR="#000077"> </FONT><I>The FvwmWinList module window.</I></P>
<P>Several other modules come with fvwm, including the Pager module, which is really
a big desk/virtual window manager, and FvwmBanner, which displays a pixmap as a background
when it starts up. The Pager module lets you create several desks, each with its
own set of virtual windows. (See Figure 22.2.)<BR>
<BR>
<A NAME="Heading46<A HREF="../art/22/2202.jpg"><FONT COLOR="#000077">FIGURE
22.2.</FONT></A><FONT COLOR="#000077"> </FONT><I>The Pager module default window.</I>
<CENTER>
<H4><A NAME="Heading47<FONT COLOR="#000077">Customization and Styles</FONT></H4>
</CENTER>
<CENTER>
<H4><FONT COLOR="#000077"></FONT></H4>
</CENTER>
<P>You can customize the appearance of fvwm with a choice of your own set of colors
instead of using the default values. Here is a list of the colors you can set in
your <TT>.fvwmrc</TT> file:
<UL>
<LI><TT>StdForeColor</TT>: Foreground color for nonselected window titles and menu
items.
<P>
<LI><TT>StdBackColor</TT>: Background color for nonselected window titles and menu
items.
<P>
<LI><TT>StickyForeColor</TT>: Foreground color for nonselected sticky window titles.
(Sticky windows always stay on the screen regardless of which desktop you happen
to be on.)
<P>
<LI><TT>StickyBackColor</TT>: Background color for nonselected sticky window titles.
<P>
<LI><TT>HiForeColor</TT>: Foreground color for selected window titles.
<P>
<LI><TT>HiBackColor</TT>: Background color for selected window titles.
<P>
<LI><TT>MenuForeColor</TT>: Foreground color for menu items.
<P>
<LI><TT>MenuBackColor</TT>: Background color for menu items.
<P>
<LI><TT>MenuStippleColor</TT>: Background color for shaded menu items.
<P>
<LI><TT>PagerForeColor</TT>: Foreground color for virtual window pager.
<P>
<LI><TT>PagerBackColor</TT>: Background color for virtual window pager.
</UL>
<P>You can define colors either by using the names found in the <TT>/usr/lib/X11/rgb.txt</TT>
file or by specifying the red, green, and blue color components using the format</P>
<PRE><FONT COLOR="#0066FF">#RRGGBB
</FONT></PRE>
<P>where RR is the red component, GG is the green component, and BB is the blue component.
All components are hex values between <TT>0</TT> and <TT>255</TT> and are represented
as hex numbers. For example, the following definitions for a black color are equal:</P>
<PRE><FONT COLOR="#0066FF">StdForeColor black
StdForeColor #000000
</FONT></PRE>
<P>For a grayscale color, you could use either of the following statements:</P>
<PRE><FONT COLOR="#0066FF">MenuForeColor gray138
MenuForeColor #8a8a8a
</FONT></PRE>
<P>Colors are not the only way you can customize your desktop. A style is used to
define the type of a window. The way to define styles in fvwm is to use this syntax:</P>
<PRE><FONT COLOR="#0066FF">Style windowName options
</FONT></PRE>
<P>The windowName can be specified to use a specific window or can be used with a
wildcard. For example, with <TT>xclock</TT>, the style will apply only to applications
called xclock. The term <TT>*clock</TT> will cause fvwm to apply the style to all
applications whose names end with "clock," such as oclock or xclock.</P>
<P>The options available for use with a style are listed here:
<UL>
<LI><TT>Border</TT>/<TT>NoBorder</TT>: Specify whether to use a border.
<P>
<LI><TT>BorderWidth</TT>: Specify the width of the border, if there is a border.
<P>
<LI><TT>Title</TT>/<TT>NoTitle</TT>: Specify whether to use a title.
<P>
<LI><TT>StartsOnDesk </TT>#: Specify which desk to start on.
<P>
<LI><TT>Sticky</TT>: Make the window sticky.
<P>
<LI><TT>StaysOnTop</TT>: Always force this window to be active.
<P>
<LI><TT>Icon </TT>name: Use as icon pixmap.
<P>
<LI><TT>WindowListSkip</TT>: Don't list in lists for windows to tab over.
<P>
<LI><TT>CirculateSkip</TT>: Don't list in circular lists.
<P>
<LI><TT>SuppressIcons</TT>: Don't allow iconic version.
<P>
<LI><TT>NoHandles</TT>: Disable resizing capability.
<P>
<LI><TT>boundaryWidth</TT>/<TT>NoBoundaryWidth</TT>: Specify boundary width.
<P>
<LI><TT>StdForeColor</TT>: Set foreground color.
<P>
<LI><TT>StdBackColor</TT>: Set background color.
</UL>
<P>Listing 22.11 shows the styles that come as a default setup with the <TT>system.fvwmrc</TT>
file.
<CENTER>
<H3><A NAME="Heading48<FONT COLOR="#000077">Listing 22.11. The default styles
in fvwm.</FONT></H3>
</CENTER>
<PRE><FONT COLOR="#0066FF">
Style "*" BorderWidth 5, HandleWidth 5, Color Black/#60a0c0,Icon unknown1.xpm
Style "Fvwm*" NoTitle, Sticky, WindowListSkip
Style "Fvwm Pager" StaysOnTop
Style "FvwmBanner" StaysOnTop
Style "GoodStuff" NoTitle, NoHandles, Sticky, WindowListSkip, BorderWidth 0
Style "*lock" NoTitle, NoHandles, Sticky, WindowListSkip
Style "xbiff" NoTitle, Sticky, WindowListSkip
Style "Maker" StartsOnDesk 1
Style "matlab" StartsOnDesk 3
Style "signal" StartsOnDesk 3
Style "rxvt" Icon term.xpm
Style "xterm" Icon xterm.xpm, Color black/grey
Style "Appointment" Icon datebook.xpm
Style "xcalc" Icon xcalc.xpm
Style "xbiff" Icon mail1.xpm
Style "xmh" Icon mail1.xpm, StartsOnDesk 2
Style "xman" Icon xman.xpm
Style "xvgr" Icon graphs.xpm
Style "matlab" Icon math4.xpm
Style "xmag" Icon mag_glass.xpm
Style "xgraph" Icon graphs.xpm
Style "GoodStuff" Icon toolbox.xpm
</FONT></PRE>
<P>As you can see, several styles come with the fvwm to get you started. Just copy
the system-wide file over to your home directory, and edit away.
<CENTER>
<H4><A NAME="Heading49<FONT COLOR="#000077">For More Information</FONT></H4>
</CENTER>
<P>The man pages for fvwm provide a great deal of very specific information. There
are many other options and features for fvwm. Check the Web pages on the Internet
for more information on fvwm. Use <TT>"fvwm"</TT> or <TT>"fvwm home
page"</TT> as the string for search engines such as Yahoo!, Excite, or AltaVista.
I found more than 2,000 entries the last time I checked! Here are some of the pages
to look at as starting points:</P>
<PRE><FONT COLOR="#0066FF">
http://www.cs.hmu.edu/~tkelly/docs/fvwm.html
</FONT></PRE>
<PRE><FONT COLOR="#0066FF">http://www.cobaltgroup.com/~roland/fvwm/fvwm.html
</FONT></PRE>
<CENTER>
<H3><A NAME="Heading50<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P>This chapter covered the topic of configuring the XFree86 system. After reading
this chapter, you should have an idea of how to set up your <TT>XF86Config</TT> file
to generate your X environment. Just remember to start with the basic configuration
settings for VGA cards and then make enhancements. Keep backups of your work, and
do not change the video settings unless you know what you're doing. If nothing works
despite your best efforts, you have the recourse of knowing where to look for answers
in FAQs, newsgroups, and FTP sites on the Internet for <TT>HOWTO</TT> and other documents
on Linux.
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -