|
发表于 2007-5-14 18:43:13
|
显示全部楼层
发现我保存有那篇文章.......
How to set Style lines
======================
This text is taken in part from my reply in the following thread:
http://fvwm.lair.be/viewtopic.php?t=772
Over the years, I've seen a lot of FVWM configs that have lines for styles
that look like this:
``
Style myapp* NoStick, NoTitle
Style Fvwm* NoBorders, NoTitle, CirculateSkip, Sticky
Style Mozilla* NoTitle
''
... which by and large are "OK", except for a few problems -- they're
greedy matches, as one would expect with '*'.
Most people I have helped, have problems with Firefox or Mozilla not
doing what it's told, or getting some very odd results with the styles
that they're defining for it. The reason for this isn't that Mozilla or
Firefox are misbehaved, but usually that there's a lack of understanding
with how Style lines are applied.
Let's assume that we're using the style lines from above:
``
Style Fvwm* NoBorders, NoTitle, CirculateSkip, Sticky
''
... this matches (in part) some of Firefox's title. If one were to then
restart FVWM with this page still showing in Firefox, then the window
would stick, which is annoying. It's certainly not what we want. Most
people naturally do this, too:
``
Style *Firefox* NoBorders
''
Which also has the same problems, and perhaps even more so, since that's
matching Firefox anywhere within the title of a window.
To get around this, something more unique needs to be used. With dynamically
changing titles such as a webbrowser, specifying the full name of the window
is undesirable as well, and ineffective, as it just won't work. Hence
FVWM allows us to also match by a window's class, as well.
Take Firefox. That will either have a class of:
``
Firefox-bin
''
or:
``
Gecko
''
The reason you want to match on a window's class in this instance is that
it's more specific, and less ambiguous than the title of the window, which
might be something like this:
``
Fvwm Forums :: Post a reply - Mozilla Firefox
''
To obtain a specific window's class, you can use a few methods. Perhaps
the preferred option is using the module "FvwmIdent". Although window
manager agnostic commands such as "xwininfo" and "xprop" can also be
used. Hence, you'd replace the previous style command with:
``
Style Gecko NoTitle
''
... you can be fairly well assured that the Class of a window tends to be
unique to that application (the exceptions are things like RXVT which
sometimes have been known to set their class to that of Xterm.)
Indeed, you might be wondering how FVWM knows in which order style lines
match. Truth is, it doesn't _really_ know how to match, however FVWM
defaults to cycling through a known series of window attributes. Hence,
FVWM will match your window in a style line thus:
``
Title --> Class --> Resource
''
x
So FVWM checks the title of a window first, and if a match is unsuccessful,
it will then look at the class, and if that fails, it will then look at
the resource of that window for a match. By and large, where wildcards
are used in style lines -- it's normally the window's title that gets
matched in the first instance.
There are other considerations that need to be taken into account. Style
lines are ANDed. That is, for successive lines that are specified one
after the other for the same application, both lines are considered.
So for the following:
``
Style foo Sticky
Style foo !Title
''
The window 'foo' would only be displayed with the title, and would
become sticky. Because of this, the ordering of style lines is VERY
important so that there's no race conditions, or other oddities that can
creep in.
One thing I'd love to see in a future version of FVWM is something like:
``
Style (class=Xterm, title=foo) StartsOnPage 0 4
''
... which would really be quite powerful. This is in the TODO file for
FVWM.
-- Thomas Adam, 20th September 2005, 17:18 GMT |
|