Chinaunix首页 | 论坛 | 博客
  • 博客访问: 486960
  • 博文数量: 115
  • 博客积分: 5016
  • 博客等级: 大校
  • 技术积分: 1401
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-21 16:03
文章分类

全部博文(115)

文章存档

2013年(1)

2010年(17)

2009年(76)

2008年(21)

我的朋友

分类: LINUX

2009-11-26 16:30:02


======================================================================
5.           5 - Development, Known Problems & Bug Reports
======================================================================

5.1  I'd really like to see neat feature XYZ in fvwm.  Wouldn't
     that be cool?  I even have a patch.  When can it be added?

A: If you plan to write a patch, please, first of all fetch the
   latest development release from our web site or better yet use CVS
   as described in http://fvwm.org/documentation/dev_cvs.php.  It is
   also a good idea to contact the fvwm-workers list.  At times,
   patches for older releases may prove completely worthless, e.g.
   because the fix has already been integrated, a feature already
   added or removed or simply because the code is very different to
   the code you patches.  You will do yourself and us a great favor.
   Otherwise all your hard work may be wasted.

   People are always requesting or suggesting new features (many of
   which are great ideas and where a lot of the current features came
   from).  One of the more common ones for example is Windows 95 look
   and feel (although since this was first written, that particular
   feature has actually been indirectly implemented via several
   appearance-affecting features).

   I'd like to make a statement about this.  fvwm is supposed to be
   small, fast, powerful, and flexible, and sometimes tradeoffs have
   to be made here.  The module interface helps here, as a lot of
   features that not everyone wants or needs don't have to be in the
   main module consuming resources for those people that don't want or
   need them.

   So if you have a suggestion (or a patch), please think of a way to
   make it as small and generic as possible if you feel it belongs in
   the main module.  Please have a look at the enhancements that are
   listed in our bug tracking system (see Q5.3).

   If you plan to make a patch, please contact the fvwm-workers
   mailing list first.  From time to time we are changing the code in
   a very disruptive way and if you create a patch to a version before
   such changes were made we will all have a hard time to integrate
   the patch.  Most of the time we will ask you to update the patch
   for the current code anyway.

   Bear in mind that we make no guarantees that we'll add any
   requested feature or apply any submitted patches to the official
   version, but please don't let this dissuade you from submitting
   them.  We like to get new ideas and we're always curious to see how
   someone would implement a given feature, even if we never plan to
   put it in fvwm. Also, we may choose to re-implement any patches
   submitted, which may change the syntax, functionality, etc.  Please
   don't take offense from that, as we mean no offense and we
   generally have a good reason (at least by our way of thinking) for
   our actions...

----------------------------------------------------------------------

5.2  How do I create/submit/apply patches?

A: First of all, please read the first section of the answer to Q5.1!

   Please add proper entries to the ChangeLog file(s) and possibly to
   NEWS and AUTHORS files whenever you submit a patch.  The ChangeLog
   lists all changed files and functions along with a useful
   explanation of the change details.  The NEWS file mentions all
   user-visible changes, including bug fixes.  Also, do not forget to
   write a section for the man page if the patch includes new
   features.

   You can find more detailed instructions for working with the
   fvwm sources in the files doc/DEVELOPERS and doc/CONVENTIONS in
   CVS or the tarballs.

   Creating a patch against CVS sources (preferable) -

        1) Execute "cvs update -AdP" to ensure there are no conflicts
           with the most recent sources.
        2) Don't forget to update the ChangeLog file (see below) and
           all manual pages if needed.
        3) In the base cvs directory run: cvs diff -u >myfeature.patch

   Creating a patch against released sources -

        1) Copy the original file(s) to the same name with the
           additional extension of .orig (or something like that).
        2) Update the ChangeLog file.  If you use (x)emacs, move the
           cursor into the function you changed and hit -x 4 a.
           This will generate an empty ChangeLog entry in the right
           file (there are several ChangeLogs).  Add a description of
           what you did.  Do this each time you change a function or
           file (for changes outside of functions).  You should update
           the AUTHORS and NEWS files too if appropriate.
           Please take the time to add the ChangeLog entries, it makes
           our work a lot easier.
        3) Run diff with either the -c (context) or -u (unified)
           switch on the sets of files, with the .orig file FIRST.  I
           prefer unified diff's because they are smaller, but
           sometimes they aren't as readable (and some diff versions
           don't support unified diffs), so either context or unified
           diffs are fine (but please, no "plain" diffs).

        ex: cp fvwm.c fvwm.c.orig ; ; diff -u fvwm.c.orig fvwm.c

   Submitting a patch -

        Mail it to the fvwm-workers mailing list
        <>.

        If your patch is large you should compress it (preferably with
        gzip).  Should it still be larger than 25k you might want to
        to place it on a web page and email the URL to the mailing
        list or ask on the fvwm-workers list first.

        Be sure to read the answer to Q5.1.

        Don't forget the ChangeLog and the documentation.

   Applying a patch -

        Get a copy of the program 'patch' from your favorite source,
        such as compile it, and then
        follow its directions (generally just cd into the appropriate
        directory and run 'patch < patchfile').

----------------------------------------------------------------------

5.3  How do I submit a bug report?

A: Please do not report any 'bugs' related to XMMS in the fvwm bug
   tracking system or the fvwm mailing lists but send them to the XMMS
   developers instead.

   Please enter a DETAILED description of your problem in our
   web-based bug-tracking system.  You can find a link on our web page
   (see Q1.3). By detailed we mean more than just "my window isn't
   behaving right" or "I found a bug":

        - First of all: use our bug tracking system! You will find
          a link to it on our main web page (see Q1.3).  If for some
          reason the bug tracking system doesn't work for you, please
          use the fvwm-bug shell script that comes with fvwm.
        - Describe the problem as best you can, preferably with
          suggestions on how to reproduce it easily
        - If applicable, include information from:
                xwininfo (preferably w/ the -all option)
                xprop
                FvwmIdent
                xdpyinfo (maybe)
        - What exact version of fvwm you are running.
        - What OS & version you are running under
        - What version of X11 are you running under, and is it an MIT
          server or a vendor specific server (e.g. the OpenWindow X
          server under SunOS)
        - How was fvwm compiled (compiler & version, options, etc)
        - What settings do you have in your config file that may be
          pertinent.

----------------------------------------------------------------------

5.4  I have a window that is behaving unexpectedly under fvwm, but
     just fine under (whatever other window manager), or I have just
     some random bug.  What do I do?

A: First, check your rc file and your .Xdefaults to make sure that
   something blatantly obvious in there isn't causing the problem.
   Second, PLEASE PLEASE PLEASE check the FAQ, BUGS, TODO, and man
   pages.  Finally, check the official WWW page and the mailing list
   archives (which have a search facility) stored there.

   If you still can't figure it out, report your problem to our bug
   tracking system (see Q5.3).

----------------------------------------------------------------------

5.5  Why do NumLock, CapsLock and ScrollLock interfere with
     ClickToFocus and/or my mouse bindings?

A: Because they are treated as modifiers.  You can use the
   IgnoreModifiers command to turn individual modifiers off for
   bindings.  With XFree86 and fvwm version 2.4.0 or above, the
   right command is

     IgnoreModifiers L25

   If you changed your modifiers manually or are using a different
   X server use the 'xmodmap' command to find out which modifiers
   correspond to the keys you want to switch off.

   This command creates a lot of extra network traffic, depending
   on your CPU, network connection, the number of Key, Mouse or
   PointerKey commands in your configuration file and the number
   of modifiers you want to ignore.  If you do not have a
   lightning fast machine or very few bindings you should not
   ignore more than two modifiers.  So do not ignore scroll-lock
   if you have no problem with it.

   A better way to solve this problem is to modify the keyboard
   mapping of your X server.  The commands

     xmodmap -e "clear Lock"
     xmodmap -e "clear Mod2"
     xmodmap -e "clear Mod5"

   remove the CapsLock, NumLock and ScrollLock from the keyboard
   map.  Pressing these keys has no effect then.  To re-add them
   try this:

     xmodmap -e "add Lock = Caps_Lock"
     xmodmap -e "add Mod2 = Num_Lock"
     xmodmap -e "add Mod5 = Scroll_Lock"

   Fvwm has to be restarted to use the changes made by
   xmodmap.  Please refer to the man page of the xmodmap command
   for further details.  If you disable the CapsLock key in your
   keyboard map in this way, you can speed up fvwm a bit by
   removing the Lock modifier from the list of ignored modifiers:

     IgnoreModifiers


   Since we all occasionally press NumLock or ScrollLock, it makes
   sense to redefine some main bindings to work with any modifiers.
   I.e. consider to replace something like this in your configuration:

     Mouse 1 R N Menu MenuFvwmRoot

   with this:

     Mouse 1 R A Menu MenuFvwmRoot

----------------------------------------------------------------------

5.6  Menus with gradient backgrounds flicker or are very slow.

A: The flickering is caused by fvwm constantly redrawing the menus
   when a sub menu pops up or down.  One way to help this is to use
   a X server with backing storage (XFree86 has backing storage
   support, I don't know about other servers but I guess that any
   decent X server has it).  If your Xserver is started with the
   -bs option, remove it.  If not try the -wm option, for example:

     startx -- -wm

   You may have to adapt this example to your system (e.g. if you
   use xinit to start X).

   If that doesn't help, either because your X server does not have
   backing storage or because system resources are limited, make
   sure sub menus do not overlap the parent menu:

     MenuStyle PopupOffset 1 100

   Unfortunately this does not work properly with the fvwm
   menu style.

   For the speed problem both suggestions above might help too.
   Another thing to try is to turn hilighting of the active menu
   item other than by foreground color off.  Put these lines in your
   fvwm/config after the menu styles have been defined:

     MenuStyle Hilight3DOff, HilightBackOff
     MenuStyle ActiveFore

----------------------------------------------------------------------

5.7  Why won't the StartIconic style work with {Netscape, etc.}?

A: The application won't allow it.  This has only been observed with
   Netscape.  When Netscape starts up, fvwm starts the main window in
   the iconic state.  Netscape immediately issues another MapRequest,
   to which the window manager must respond by de-iconifying the
   window, according to the ICCCM rules.  (Netscape can be persuaded
   to start iconic, however, by invoking it with the -iconic command
   line flag.)

----------------------------------------------------------------------

5.8  How do I capture the output (e.g. errors) of fvwm?

A: Errors are reported to the standard error file.  You can redirect
   standard error to a file when fvwm is started: "fvwm 2>
   fvwm-errors". X sessions started by xdm often redirect errors to a
   file named ".xsession-errors".

   Alternatively, FvwmConsole or "FvwmForm FvwmForm-Talk" modules
   will display error messages.

----------------------------------------------------------------------

5.9  I try to run some program under fvwm, but it dies with an X11
     error like BadAccess.  The same program works just fine under MWM
     or OLWM.  What's going on?

A: The error message usually looks something like this:

        X Error of failed request:  BadAccess (attempt to access private
        resource denied)
         Major opcode of failed request:  28 (X_GrabButton)
         Serial number of failed request:  1595
         Current serial number in output stream:  1596

   Well, this is telling you that there is a conflict in key/button
   assignments.  In your config you have bound some key/button that
   this program really wants to bind to an action, but it can't since
   fvwm has already done so (but you weren't doing it in the rc file
   for your previous window manager).  Figure out what the offending
   key binding is and remove it from your fvwm/config, or temporarily
   via "FvwmForm FvwmForm-Talk" by removing the fvwm binding (see the
   man page for the Key & Mouse commands).

----------------------------------------------------------------------

5.10  Every time I update my install, my currently running fvwm
      session dies.  Why is that?

A: Many OSes swap the program from memory via the image on the disk,
   and if you overwrite it, and then the current one tries to swap
   something back into memory before you restart, it'll core dump.  To
   avoid this, rename your old executables or move them to some other
   directory.  The 'mv' command preserves the inode so it won't
   core dump, but then when you restart fvwm it'll pick up the new
   copy.

----------------------------------------------------------------------

5.11  After I restart fvwm certain windows or icons raise above
      all other windows and cannot be lowered by any means.  One
      example are the shortcuts of KFM (the KDE file manager).
      What can I do about that?

A: Some applications use so called 'override redirect' windows that
   are not (and cannot be) managed by the window manager.  By
   convention as defined in the ICCCM, such windows must only be
   displayed for a very short time.  KFM and possibly other
   applications ignore this convention and use permanent 'override
   redirect' windows, e.g. the KFM shortcuts.  Fvwm can not easily
   detect these windows when it restarts and places the windows
   managed by fvwm below them.

   However, since fvwm version 2.3.8 there is a command that will
   help you, although it might cause trouble with other applications
   using 'override redirect' windows.  We can't make any promises
   since KFM is violating the conventions and the applications may
   violate them in different ways.

   Now the command.  Put this anywhere in your config file:

     BugOpts RaiseOverUnmanaged on

----------------------------------------------------------------------

5.12  The StartsOnPage style does not work for me.  Why?

A: Many applications request a specific position where they want to
   appear (the so called 'program specified position').  Unless fvwm
   is told explicitly to ignore this, the program specified position
   overrides the StartsOnPage style.  Use this line in your
   configuration file:

     Style * NoPPosition

----------------------------------------------------------------------

5.13  Some modules can not be started when I restart fvwm.

A: You may see the following error message on the console:

     [fvwm][PositiveWrite]: <> Failed to read descriptor:
     - data available=N
     - terminate signal=N

   It means that fvwm has given up waiting for one of its modules to
   reply, and so has killed it.  The length of the timeout is a
   configuration parameter - try adding

     ModuleTimeout 10

   to your config file.  The units are in seconds and the default
   value is 5.

   This problem will only occur on slow machines or high system load
   (many open windows).


----------------------------------------------------------------------

5.14  I'm running Rational Rose and fvwm ignores its windows.

A: This problem might occur on other applications besides the one
   mentioned.

   The symptoms as reported by Raymond Toy are:

     I've been using fvwm for ages and it's always worked for me just
     fine.  However, I've started using Rational Rose for Solaris.  fvwm
     seems to get completely confused.

     o Fvwm doesn't draw any frames around the Rose window like it
       does for all other windows (except for those I explicit said
       not to).

     o The Rose window is always on top.  Nothing I do can bring
       another window above the Rose window.

     o Using fvwm's identify window module shows nothing.  No identify
       window pops up showing the window info.

     o Focus sometimes seems to be lost.  (I have focus follows
       mouse).  I have to move the mouse out of the window and back in
       to get focus. Sometimes I also have to click in the window to
       get focus.

     The annoying thing is that this all seems to work with CDE and
     dtwm. I don't want to have to switch to dtwm so any hints or
     pointers on where to look to get fvwm to understand this window
     would help me a lot.


   Heres what we found out:

   Rational Rose uses software from Mainsoft that lets MS Windows
   applications be recompiled to run on UNIX.

   There are 2 Mainsoft Knowledgebase pages that relate to UNIX
   window managers:

       
        http://dev.mainsoft.com/Default.aspx?tabid=58 [KBMW0034]

   These pages suggest that you export MWWM=allwm or MWWM=MWM before
   starting the application. The first page is missing, but can be
   found using

   Raymond reports:

     This works just fine!   Setting MWWM=allwm, Rose  comes
     up like a normal X app where  the WM draws the borders.
     With MWWM=MWM, it works ok too except that for the main
     window,  no borders are drawn  by the WM and Rose draws
     it's own  borders (I  have  fvwm respecting   MWM decor
     hints).  (This   is     correct  as mentioned by    the
     Knowledgebase pages above.)   I don't  recall what Rose
     looks like with dtwm, but I suspect it's quite close to
     all MWWM=MWM.

   Next we had Klaus Zeitler report that the Rational Rose official
   startup script is explicitly setting ALLWM to nothing.  This makes
   it more difficult for an individual user to set this variable.
   If you can, you can just modify the script, otherwise, your other
   alternative is to copy the script somewhere where you can modify it
   and run it from there.

----------------------------------------------------------------------

5.15  Although I use the WindowListSkip style for my modules they
      still show up in FvwmIconMan, FvwmWinList etc.

A: Make sure you have

     *FvwmIconMan: UseWinList true

   in your config file.  If that does not help, the modules you are
   using may not match the fvwm executable.  Recompile and reinstall
   everything and the problem should go away.

----------------------------------------------------------------------

5.16  When I Maximize an application, sometimes I get gaps around
      the edges, and other times I don't.  What's going on?

A: The ICCCM specification allows applications to specify certain
   properties the window manager should honor, such as aspect
   ratio (PAspect) or increments to be resized in (PResizeInc).  Of
   course, sometimes these properties won't perfectly match the
   size of your desktop (or ewmh struts), if that should happen,
   you will get gaps.

   In general, the application will have a good reason for doing
   this (for example, a terminal window may not want to have only
   part of a column visible), but you can make fvwm ignore the
   hints with

     Style * ResizeHintOverride

 

6.各种各样的问题
==============================================

6.1 DESK,PAGE
SCREEN之间的确切差别是什么?
A
:命名惯例是造成它们之间混淆的一个原因,当讨论问题或做其它的事情时,我们希望一个词一直保持它原来的意思。要说明fvwm的特性,就要谈到:fvwm有多个分开的DESKTOP,每个DESKTOPMxNPAGE组成,而每个PAGE和物理屏幕(SCREEN)一样大小。物理屏幕(SCREEN)就是当前DESK的一个PAGE的观察口。下面的图可以说明这个问题(可以再看一看FvwmPager模块):

Desk 0 Desk 1
+----------+----------+ +----------+----------+
| | | | | |
| Page 0 0 | Page 1 0 | | | |
| | | | | |
| | | | | |
+----------+----------+ +----------+----------+
|+--------+| | | | |
||Page 0 1|| Page 1 1 | | | |
|| || | | | |
|+--------+| | | | |
+----------+----------+ +----------+----------+

上面的图显示了两个2x2DESKTOPS。如果当前DESK0号,当前PAGE是(01,那么SCREEN将只显示在当前DESK当前PAGE上的程序窗口。

桌面从0开始连续编号。用户并不需要去创建新桌面,这些细节都在fvwm内部处理。可以配置键绑定来决定显示哪个桌面,在不同的桌面间切换。例如,要使Meta-1Meta-4分别显示桌面03,可以把下面几行添加到配置文件里:
Key 1 A M GotoDesk 0
Key 2 A M GotoDesk 1
Key 3 A M GotoDesk 2
Key 4 A M GotoDesk 3
同理也可以这样设置page.例如每个桌面有2x2pages,你可以用Meta-F1 Meta-F4分别切换到各个page
DeskTopSize 2x2
Key F1 A M GotoPage 0 0
Key F2 A M GotoPage 1 0
Key F3 A M GotoPage 0 1
Key F4 A M GotoPage 1 1

可以创建一个pager把每个桌面都显示出来(这样便于用鼠标在它们之间切换)。显示前4个桌面的命令是:
Module FvwmPager 0 3

或者你只想在pager中看到当前的桌面:

Module FvwmPager * *
-------------------------------
6.2
我喜欢{OpenWindows,NeXT,WIn95,Mac等等}的外观和感觉,你们准备支持这些吗?
A:
这不是我们的首要任务,但是我想fvwm在这方面做的很好.
你可以看看下面地址:

--------------------------------
6.3
我可以从哪找到更多的用作图标的XPM图片?
A:
如果你需要彩色图标,可以从ctwmftp.x.org)上抓取,那里有很多漂亮图片。你也可以在ftp.x.org上找到很多其它窗口管理器的图标,还有在~anthony/icons/也有。(我相信哪里有很多).
fvwm的网站上,你可以找到一些随fvwm一起发布的基本的图标,还有一些关于图标资源的链接。
你可以看看下面地址内容:

----------------------------------------------------------------------
6.4Linux X86
虚拟屏幕大小和fvwm交互....
A:
如果你不喜欢linux的虚拟屏幕可以从配置文件XF86Config里把它关掉.XFree86的虚拟屏幕特性,加上在一些显卡上的缺乏支持,就是没什么用。如果你使用了窗口管理器,它已经帮你实现了虚拟桌面。
----------------------------------------------------------------------
6.5
我知道这个问题与fvwm不相关,但是Rob Nation曾经支持的rxvtrclock现在怎么样了,去哪里可以找到它们?
A:rxvt
的官方站点:

rclock
也可以在那个rxvt发行上找到。
------------------------------------------
6.6
我如何使用fvwm设置桌面背景?
A:
其实设置桌面背景不是窗口管理器的任务。如果你使用的是linux的某一个发行版,里面会有个程序为你设置背景。
fvwm
也自带了一个程序(fvwm-root,以前叫作xpmroot),你可以用它把XPMPNG格式的图片设为桌面背景。还有象xvxlixloadimagedisplayEsetroot都可以帮你设置背景,它们支持一些fvwm-root不支持的图片格式。
如果你只想要一个静态的背景,可以在.xsession.xinitrc文件里使用上面的某个程序进行设置。也可以在fvwm的初始化函数initFunction里设置。

fvwm
模块FvwmBacker可以利用外部程序根据你的当前所在桌面改变桌面背景。用外部程序的一个缺点是速度比较慢。FvwmBacker能使用定义在colorset里的图片,并进行缓冲以提高改变背景的速度。例如:

Colorset 10 TiledPixmap foo.xpm
Colorset 11 Pixmap bar.png
FvwmBacker: Command (Desk *, Page * 0) Colorset 10
FvwmBacker: Command (Desk *, Page * 1) Colorset 11

然而,fvwm只能处理xpmxbmpng格式的图片,其它格式须转换后方可使用。
----------------------------------------------------------------------
6.7
使用fvwm时,我的颜色设置"XYZ"得不到正确的颜色,哪里的问题?
A:
我们已经提到过关于FvwmForm全是白色,图标不能显示和不能正确分配颜色等等的问题。

一些老的硬件使用了8位色深,或者由于你没有设置好新的硬件导致它们只能使用8位色深。这种情况下在同一时刻只能使用256种颜色。
下面的链接有非常详细的解释:


如果你的显示器可以支持多于256种的颜色,照做就可以了。需要的时候用"man X"查看一下X服务器的文档。
如果你只能使用8为色深,fvwm可以帮你解决问题。在2.2.x版本,使用"ColorLimit"命令可以减少fvwm在图标上使用的颜色数。在2.3.x及其以后各版本,ColorLimit是自动的,但仍然可以用它进一步减少使用的颜色数。

除此外,你还可以:

-
运行Netscape时加上“-install”参数。

-
如果你使用了背景图片,减少图片使用的颜色数。对于xv加“-nc nn”参数,对于xli加“-colors nn”参数

-
不要使用颜色渐变。

-Some applications are color hungry.
TK构建的程序,默认设置下的FrameMaker都是这样的。

如果你还是有问题,试一下fvwm的邮件列表。
----------------------------------------------------------
6.8
我刚弄到一个57键的鼠标,如何在fvwm种使用?

A:
呵呵,我知道你没有57键的鼠标,目前最多只有7个键的。从Fvwm2.4.0开始Fvwm支持所有X官方支持的5键鼠标,从2.5.11开始默认支持9键鼠标。

2.5.11
及以后版本:

要使用多于9键的鼠标(最多31键),修改文件 libs/defaults.h,把下面这行
#define NUMBER_OF_EXTENDED_MOUSE_BUTTONS 9

改为
#define NUMBER_OF_EXTENDED_MOUSE_BUTTONS 15

2.4.10
2.5.10版本:

使用多于5键的鼠标,修改文件 libs/defaults.h,把下面这行
#define NUMBER_OF_MOUSE_BUTTONS 5

改为
#define NUMBER_OF_MOUSE_BUTTONS 7

然后重新编译安装fvwm。然而数值编号大于5的键可能不会正常工作,这是因为X没有在一些函数里提供必要的界面支持,来处理大于5的键。这就意味着一些使用第6键或更大键的功能不能使用。

你可以使用的最大值是31,更大的值可能不会起作用,甚至可能使fvwm或它的模块崩溃。
---------------------------------
6.9
为什么fvwm更改了我的X鼠标指针主题
A
:并没有更改。始终有一个标准的鼠标指针集可以使用,象十字状的,左指箭头状的,铅笔状等。你的主题应该提供这些,但有些可以没有。如果有程序(如一个应用程序或fvwm)需要一个指针而你的主题有没有,X就使用默认值。如果你看到fvwm使用了不属于你主题的指针,可以使用CursorStyle更改,或者找一个更全的主题。注意,fvwm不控制应用程序使用什么样的指针。

 

=====================================================================
7 -
开发者的一些提示和示例
======================================================================
7.1
测试新配置的简单方法。
你知道吗,对于大部分配置命令要看它们做了什么,并不需要重启X或者fvwm。有一些模块可以让你在任何时候向fvwm发送命令,其中有FvwmCommand"FvwmForm-Tolk"FvwmConsole.我个人比较喜欢FvwmCommandFvwmConsole
当打开FvwmConsole时,你看到一个shell,通过它你可以向fvwm发送配置命令。如下配置,就可以在菜单里加一个启动FvwmConsole的选项:

AddToMenu main_menu
+ "FvwmConsole" Module FvwmConsole

更巧妙的方法是使用FvwmCommand。在配置文件里添加下面一句启动FvwmCommand服务器:

Module FvwmCommandS

确保FvwmCommand模块在你的搜索路径里。服务器启动后,就可以在你喜欢的shell输入命令了:
FvwmCommand "MenuStyle * Font 6x9"

注意要把命令放在引号里。FvwmCommand的优点是可以使用你喜欢的shell,利用shell的特性(如命令行补全和历史),缺点是有点慢,因为FvwmCommand每次只能启动一条命令。

其它相关的模块和命令是FvwmScriptPipeRead
----------------------------------------------------------------------

7.2
在配置里使用shell命令

有时侯你也许想在配置文件config里使用shell命令或脚本的输出,比如你想要一个菜单,菜单的各项是某个目录下的所有文件名。这种效果可以使用PipeReadFvwmCommand得到。我推荐使用PipeRead,因为使用FvwmCommand创建20个菜单项就需要相当的时间。

例:
# make the background menu
AddToFunc MakeBackgroundMenu
+ "I" DestroyMenu BackgroundMenu
+ "I" AddToMenu BackgroundMenu Backgrounds Title
+ "I" PipeRead 'for i in `/bin/ls $HOME/.fvwm/backgrounds/*.bg.*`; \
do echo -e AddToMenu BackgroundMenu `basename $i | sed -e \
"s/\.bg\..*$//"` Function SetDefaultBackground $i; done'

# set the default background
AddToFunc SetDefaultBackground
+ "I" Exec echo -e $0 > $HOME/.fvwm/background
+ "I" Function SetBackground

# set a new background
AddToFunc SetBackground
+ "I" Exec test -r $HOME/.fvwm/background && xv -root -quit -viewonly \
`cat $HOME/.fvwm/background|tr -d "\n"`

# activate setting from last session and build the menu
AddToFunc InitFunction
+ "I" Function SetBackground
+ "I" Function MakeBackgroundMenu

MakeBackgroundMenu
函数创建一个菜单,各菜单项是在目录$HOME/.fvwm/backgrounds下的且匹配"*.bg.*"模式的文件名,后缀.bg.*被删除。当我们选择其中一项时,使用xv把对应的文件设置为桌面背景,并把该文件名和路径存到文件$HOME/.fvwm/background中,当我们开始下一个fvwm会话时,就可以把桌面设为和上次会话同样的背景。

我还有一个更加复杂的关于调色版的设置。
----------------------------------------------------------------------

7.3
如何在非当前deskpage启动程序。

使用'StartsOnDesk''StartsOnPage' style:

Style Netscape* StartsOnPage 0 1

or

Style Netscape* StartsOnDesk 1

这样标题以'Netscape'开始的窗口都会被放在page 0 1(desk 1).你可能希望使用下面的选项:
Style * RecaptureHonorsStartsOnPage, CaptureHonorsStartsOnPage

如果你想在其它的page启动程序,但是并不切换到那个page,这需要使用'SkipMapping' style:
Style Netscape* StartsOnPage 0 1, SkipMapping

----------------------------------------------------------------------

7.4
如何在非当前deskpage打开一个应用程序,且不切换观察口(viewport)到打开程序的pagedesk

使用SkipMapping style:

Style Netscape* StartsOnPage 0 1, SkipMapping
----------------------------------------------------------------------

7.5
更高效的MWM菜单

可能你已经注意到,对于MWM菜单,只要指针移到菜单项子菜单就会弹出,即使你只想移动到下面。这种情况可以使用MenuStyle 'PopupDelay' 'PopupDelayed'选项:
MenuStyle mwm
MenuStyle PopupDelayed, PopupDelay 80

这样,子菜单会在指针移动到菜单项的80毫秒后打开。你很难感觉到这个延迟。注意只是在我的机器上,80毫秒足够指针经过菜单了,你可能需要实验一下找到一个合适的值。
----------------------------------------------------------------------

7.6
关于在屏幕上放置菜单
你有过想打开主菜单但却找不到地方的时候吗?还得关闭窗口或者满屏幕的移动鼠标?
如果是的话,你可以使用下面的快捷键:

Key space A M Menu root c c main_menu

这样设置后,当你按下Alt-space就会在屏幕的中心弹出名为main_menu的菜单。或者你想给window menu设置一个快捷键:

Key space A SM Menu root c c WindowMenu

你可以把菜单放到任何地方,不仅是鼠标指针所在的位置。细节请看man page中的Menu命令。
----------------------------------------------------------------------
7.7
当鼠标接近屏幕边缘,有时候会发生flipping pages,你遇到过吗?

可以使用EdgeScroll命令禁止flipping pages

EdgeScroll 0 0
----------------------------------------------------------------------

7.8
给你的窗口和图标排队

SnapAttraction
SnapGrid命令可以用来保持桌面的整洁。使用SnapAttraction可以使窗口(或者图标)互相紧贴在一起。当拖动窗口(图标)临近另一个窗口(图标)的时候,就紧贴到那个窗口(图标)上,边缘之间没有任何间隙。把下面的命令放到配置文件里:

SnapAttraction 8 SameType


这个命令的意思是如果窗口间的距离小于8个象素时,就互相贴在一起,图标和图标间也是如此。或者你只想应用到窗口/图标上,可以使用:
SnapAttraction 8 Windows

or

SnapAttraction 8 Icons

或者你想窗口与图标之间也可以相互紧贴:
SnapAttraction 8 All

SnapGrid
命令也很有用:

SnapGrid 8

这个命令告诉fvwm使用8个象素大小的格子放置窗口和图标。试一下看看你喜不喜欢。

提示:SnapGrid的参数最好选用桌面的宽和高的约数.
----------------------------------------------------------------------

7.9
使用键盘移动鼠标/聚焦/page.

移动鼠标的键绑定:
# shift- to move a few pixels
Key Left A S CursorMove -1 0
Key Right A S CursorMove +1 +0
Key Up A S CursorMove +0 -1
Key Down A S CursorMove +0 +1

# shift-meta- to move 1/4 page
Key Left A SM Scroll -25 +0
Key Right A SM Scroll +25 +0
Key Up A SM Scroll +0 -25
Key Down A SM Scroll +0 +25

移动pages的键绑定:
# shift-control- to move a full page
Key Left A SC CursorMove -10 +0
Key Right A SC CursorMove +10 +0
Key Up A SC CursorMove +0 -10
Key Down A SC CursorMove +0 +10

# Alt-Fn to go to a specific page (like on the Linux console)
Key F1 A M GotoPage 0 0
Key F2 A M GotoPage 1 0
Key F3 A M GotoPage 0 1
Key F4 A M GotoPage 1 1

按指定方向改变focus到一个窗口:
# number keys on keypad to move the focus
Key KP_1 A C Direction SouthWest Focus
Key KP_2 A C Direction South Focus
Key KP_3 A C Direction SouthEast Focus
Key KP_4 A C Direction West Focus
Key KP_6 A C Direction East Focus
Key KP_7 A C Direction NorthWest Focus
Key KP_8 A C Direction North Focus
Key KP_9 A C Direction NorthEast Focus

----------------------------------------------------------------------

7.10
防猫安全桌面^_^

如果你的猫总是趁你煮咖啡的时候爬上键盘,下面的某个设置可能会帮上忙:

使用'Style * MouseFocus',在你离开的时候把鼠标指针放到桌面背景上(根窗口)。
如果你不想改变‘SloppyFocus’的设置,那就把鼠标指针移动到一个永远不会得到键盘输入的窗口,使它成为focused的窗口。更狂热的想法是用猫的图片做一个窗口^_^
----------------------------------------------------------------------

7.11
下降并移动窗口。

在一些配置里,使用鼠标中键移动窗口后,窗口会下降。如果是先下降,然后移动窗口会有很好的视觉效果:

Mouse 2 T A Function MoveOrLower

AddToFunc MoveOrLower
+ "Click" Lower
+ "Motion" Lower
+ "Motion" Move
+ "DoubleClick" Lower

----------------------------------------------------------------------

7.12 Toggling windows on and off.
固定、解除固定窗口


如果有一个按钮或菜单项,第一次使用时它打开程序,第二次使用时它关闭程序,那将是令人期待的。如何实现这个效果好像不太容易想到,但确实是可以的。假设你需要一个菜单项用来打开和关闭FvwmConsole.
把下面的内容放到配置文件里(fvwm-2.5.11及后续版本):
AddToFunc ToggleFvwmConsole
+ I ToggleWindow FvwmConsole "Module FvwmConsole"

# Application toggling function
#
第一个参数是窗口名,第二个是启动程序的命令
AddToFunc ToggleWindow
+ I None ($$0, CirculateHit) $$1
+ I TestRc (Match) Break
+ I Next (currentpage, visible, !iconic, $$0, CirculateHit) Close
+ I TestRc (Match) Break
+ I Next ($$0, CirculateHit) Function MakeVisible

# Helper function
AddToFunc MakeVisible
+ I MoveToDesk
+ I MoveToPage
+ I MoveToScreen
+ I Raise
+ I Iconify off
+ I WindowShade off


要使用这个函数,把它放到菜单里:
AddToMenu
+ "toggle FvwmConsole" Function ToggleFvwmConsole

如果你更喜欢按钮,就放到FvwmButtons:
*FvwmButtons: (Action ToggleFvwmConsole)

对于不可见的窗口,并不关闭它们,而是由包含MoveToDesk, MoveToPageRaise的行把它带到当前page的顶层。

如果你只想针对特定的窗口,比如某个xterm,但是其它的xterm还保持原来的样子,那么你必须给这个窗口一个唯一的名字:

AddToFunc RunXMessages
+ I Exec exec xterm -T XMessages -n XMessages \
-e tail -f /var/adm/?* ~/.X.err

AddToFunc ToggleXMessages
+ I ToggleWindow XMessages "Function RunXMessages"

值的注意的是,这个函数只是简单的查找是否有指定名字的窗口存在。所以该函数可能关闭手动打开的窗口,或者因为程序启动太慢而多次启动同一个程序(netscape)

fvwm-2.5.10及早些的版本中,下面的函数也可以实现这个功能:
AddToFunc ToggleFvwmConsole
+ I None (FvwmConsole, CirculateHit) Module FvwmConsole
+ I Next (FvwmConsole, CirculateHit, CurrentPage, Visible) Close
+ I Next (FvwmConsole, CirculateHit) MoveToDesk
+ I Next (FvwmConsole, CirculateHit) MoveToPage
+ I Next (FvwmConsole, CirculateHit) Raise

AddToFunc ToggleXMessages
+ I None (XMessages, CirculateHit) Exec exec \
xterm -T XMessages -n XMessages -e tail -f /var/adm/?* ~/.X.err
+ I Next (XMessages, CirculateHit) Close

----------------------------------------------------------------------

7.13
通过点击打开程序(称为docking程序)

通常一个图标代表一个最小化的程序。但是如果你想通过点击图标来启动程序,也是可以的。使用FvwmButtons实现:
# FvwmButtons icon launcher:
DestroyFunc Launcher
AddToFunc Launcher
+ I DestroyModuleConfig $0Launch: *
+ I *$0Launch: Geometry 64x68
+ I *$0Launch: Columns 1
+ I *$0Launch: Rows 4
+ I *$0Launch: Frame 0
+ I *$0Launch: (1x3+0+0, Icon $1, Action (Mouse 1) `Exec $2`)
+ I *$0Launch: Pixmap none
+ I *$0Launch: (1x1+0+3, Font 9x15, Fore White, Back DarkBlue, \
Title $0, Action (Mouse 1) `Exec $2`)
+ I Style $0Launch HandleWidth 0, NoTitle
+ I Module FvwmButtons $3 $0Launch
# Examples:
Launcher RXVT xterm.xpm "rxvt -bg black" "-g +0+0"
Launcher XV xv.xpm "xv" "-g +0+100"

GNOME
KDE也有实现同样功能的程序gmckfm。这些程序同样可以在fvwm中运行。在fvwm-2.5.1及后续版本中可以使用Nautilus(版本>=2)kdesktop
----------------------------------------------------------------------

7.14
精确定位窗口

这个例子演示了如何把窗口放到屏幕中心。注意这里是如何使用PipeRead的,以及如何使用$(())进行算数计算的。
DestroyFunc CenterWindow
AddToFunc CenterWindow
+ I ThisWindow Piperead "echo Move \
$(( $[vp.width]/2-$[w.width]/2 ))p \
$(( $[vp.height]/2-$[w.height]/2 ))p"

如果你有一个名为"MyWindow"的窗口,使用下面的命令把它放到屏幕中心
Next (MyWindow) CenterWindow

去掉ThisWindow,可以在没有窗口上下文而调用CenterWindow时避免一些错误。

fvwm-2.5.11中,可以使用“Style X CenterPlacement”把窗口放到屏幕中心。
----------------------------------------------------------------------

7.15
隐藏鼠标指针

有些用户不喜欢鼠标总是挡在前面。你可以安装unclutter程序,它会在鼠标不移动时隐藏鼠标。
----------------------------------------------------------------------

7.16
寻找鼠标指针

有的时候怎么也找不到鼠标指针,下面给出一个找到它的方法:
Key Super_L A A Exec xmessage -name "SmallBlob" -bg red \
-fg white -nearmouse -timeout 1 'I am here!'
Style SmallBlob UsePPosition, NoTitle, NoHandles, BorderWidth 10

----------------------------------------------------------------------

7.17
自动隐藏FvwmButtons或其它窗口

有些应用程序有自动隐藏的特性,就是把窗口放到一个特定区域而不占用宝贵的桌面空间。在fvwm中可以通过写一些小的函数来隐藏任何窗口。

fvwm-2.5.11
或后续版本:

#
自动隐藏函数
AddToFunc autohide
+ I ThisWindow ($0) Deschedule $[w.id]
+ I ThisWindow ($0) KeepRc ThisWindow (shaded) WindowShade off
+ I TestRc (!Match) All ($0, !shaded) autohide_hide $1 $2

AddToFunc autohide_hide
+ I Schedule $0 $[w.id] WindowShade $1
+ I Schedule $0 $[w.id] Deschedule $[w.id]

#
打开FvwmAuto
AddToFunc StartFunction
+ I Module FvwmAuto FvwmAutohide -menter enter_handler

#
添加你想自动隐藏的窗口
AddToFunc enter_handler
+ I autohide FvwmButtons 500 S
# ^ ^ ^
# | | |___ Shade direction (
可选的)
# | |_______
隐藏延迟 (毫秒)
# |___________________
唯一的窗口名/资源

照着上面的例子,添加你想自动隐藏的窗口到enter_handler函数。autohide函数需要两个或三个参数。第一个是窗口或者类的名字,必须是唯一的名字。第二个是隐藏延迟,从指针离开窗口算起到窗口隐藏的时间,以毫秒为单位。最后一个参数是可选的,表示窗口隐藏的方向(N, S, E, W, NW, NE, SW or SE)。

下面是一个稍复杂一点的版本。和上面的不同在于不是立即显示窗口,而是有一点延迟。
fvwm-2.5.11
及后续版本:

AddToFunc autohide
+ I ThisWindow ($0) Deschedule $[w.id]
+ I TestRc (!Match) Deschedule -$[w.id]
+ I ThisWindow ($0) KeepRc ThisWindow (shaded) \
autohide_show $1 $3
+ I TestRc (!Match) All ($0, !shaded) autohide_hide $2 $3

AddToFunc autohide_show
+ I Schedule $0 -$[w.id] WindowShade $1 off
+ I Schedule $0 -$[w.id] Deschedule $[w.id]
+ I Schedule $0 -$[w.id] Deschedule -$[w.id]

AddToFunc autohide_hide
+ I Schedule $0 $[w.id] WindowShade $1 on
+ I Schedule $0 $[w.id] Deschedule $[w.id]
+ I Schedule $0 $[w.id] Deschedule -$[w.id]

AddToFunc StartFunction
+ I Module FvwmAuto FvwmAutohide -menter enter_handler

AddToFunc enter_handler
+ I autohide FvwmButtons 250 500 S
# ^ ^ ^ ^
# | | | |__ Shade direction (optional)
# | | |______ Hide delay
# | |__________ Show delay
# |______________________ Unique window name/resource

2.5.82.5.10这些函数都可以使用,但是你不得不从autohide函数中删除KeepRc命令。
----------------------------------------------------------------------

7.18 Using application screenshots as icon or mini icon
thumbnails.
使用程序的截图作为图标或缩略图?

通过脚本,fvwm可以在窗口最小化和改变大小时取得程序窗口的截图,并把它作为程序的图标。有一些程序本身就有这个能力,我们建议使用程序本身的功能。
对于xterm,可以在启动时加上 +ai(表示active icon)选项:
$ xterm +ai

对于XEmacs,有一个live-icon elisp包可以使用。安装后把下面几行放到XEmacs配置文件里
(load-library "live-icon")
; Control size, same as max icon size, uncomment if you want
; this feature.
;(setq live-icon-max-height 4
;(setq live-icon-max-width 4

确保你没有对这些程序使用style IconOverride,这个选项禁止使用动态图标。除此外,可能还有许多其它程序有这类特性。

如果你想利用fvwm来使用程序的缩略图作为图标,那么fvwm的版本不能低于2.5.8,这是因为要使用WindowStyle命令。此外还需要ImageMagick工具集(注:一些处理图像的工具),设置好环境变量$PATH,让fvwm可以找到它。

下面的函数Thumbnail用来代替Iconify,可以在键绑定里使用它提升窗口,获取窗口截图并设置截图为窗口的图标。获取窗口截图可能需要几秒钟。窗口会立即最小化,但新的缩略图只有截图准备好了才能显示出来。

注意,截图只能从窗口的可视部分获得。如果窗口有一部分在屏幕外,在另外一个桌面或被其它窗口挡住了,缩略图可能比预期的小,或者挡住的部分显示不出来。这个没什么办法可以解决。

相同的办法也可以用于mini icon,只要把下面出现的icon都换成miniicon就可以了。
DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I ThisWindow (!Shaded, Iconifiable, !Iconic) PipeRead \
"xwd -silent -id $[w.id] | convert -scale 64 -frame 1x1 \
-mattecolor black -quality 0 xwd:- \
png:$[FVWM_USERDIR]/icon.tmp.$[w.id].png \
&& echo WindowStyle IconOverride, \
Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png \
|| echo Nop"
+ I Iconify

窗口返回到通常状态时,可以使用模块FvwmEvent删除Thumbnail产生的图标。
DestroyFunc DeThumbnail
AddToFunc DeThumbnail
+ I Exec rm -f $[FVWM_USERDIR]/icon.tmp.$[w.id].png
+ I DestroyWindowStyle

*FvwmEvent: deiconify DeThumbnail

AddToFunc StartFunction I Module FvwmEvent

如果你想把DestroyWindowStyle用作其它目的而不能使用它时,可以先把窗口的当前图标保存起来,一会需要的时候再恢复它。这种方法只能用在fvwm2.5.9及后续版本。

下面是Thumbnail函数
DestroyFunc Thumbnail
AddToFunc Thumbnail
+ I Raise
+ I SetEnv Icon-$[w.id] $[w.iconfile]
+ I ThisWindow (!Shaded Iconifiable !Iconic) PipeRead \
"xwd -silent -id $[w.id] | convert -scale 64 -frame 1x1 \
-mattecolor black -quality 0 xwd:- \
png:$[FVWM_USERDIR]/icon.tmp.$[w.id].png \
&& echo WindowStyle IconOverride, \
Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png \
|| echo Nop"
+ I Iconify

DeThumbnail
函数用来恢复存的图标:
DestroyFunc DeThumbnail
AddToFunc DeThumbnail
+ I PipeRead "echo WindowStyle Icon \\$\\[Icon-$[w.id]\\]"
+ I UnsetEnv Icon-$[w.id]
+ I Exec rm -f $[FVWM_USERDIR]/icon.tmp.$[w.id].png

要想在重启fvwm后还能使用这些缩略图标,可以在StartFunction里加入下面的几行
AddToFunc StartFunction I Test (Restart) All (Iconic) \
Test (f $[FVWM_USERDIR]/icon.tmp.$[w.id].png) WindowStyle \
IconOverride, Icon $[FVWM_USERDIR]/icon.tmp.$[w.id].png

你也可以检查一下忘了删除的缩略图,并在ExitFunction函数里删除它们。
AddToFunc ExitFunction I Test (!ToRestart) \
Exec rm -f $[FVWM_USERDIR]/icon.tmp.*

相同的办法也可以用于mini icon,只要把出现的icon都换成miniicon就可以了。
阅读(2235) | 评论(0) | 转发(0) |
0

上一篇: fvwmFAQ中文版(-)

下一篇:FVWM简明使用指南

给主人留下些什么吧!~~