「FVWM」- Window Styles @20210124

AddButtonStyle button [state] [style] [-- [!]flag ...]

Adds a button style to button.

button can be a button number, or one of "All", "Left" or "Right".

state can be "ActiveUp", "ActiveDown", "InactiveUp" or "InactiveDown", or "Active" (the same as both "ActiveUp" and "ActiveDown") or "Inactive" (the same as both "InactiveUp" and "InactiveDown") or any of these 6 with "Toggled" prepended. The "Active" states apply to the focused window, the "Inactive" ones apply to all other windows. The "Up" states apply to the non pressed buttons, the "Down" ones apply to pressed buttons. The "Toggled" prefix refers to maximized, shaded or sticky windows that have the corresponding MwmDecor... button style set. Additionally, the following shortcuts may be used: "AllNormal", "AllToggled", "AllActive", "AllInactive", "AllUp", "AllDown". They are actually different masks for 4 individual states from 8 total. These are supported too: "AllActiveUp", "AllActiveDown", "AllInactiveUp", "AllInactiveDown".

If state is omitted, then the style is added to every state. If the style and flags are enclosed in
parentheses, then multiple state definitions can be placed on a single line. Flags for additional
button styles cannot be changed after definition.

Buttons are drawn in the order of definition, beginning with the most recent button style, followed by
those added with AddButtonStyle. To clear the button style stack, change style flags, or for
descriptions of available styles and flags, see the ButtonStyle command. Examples:

 

ButtonStyle 1 Pixmap led.xpm -- Top Left
ButtonStyle 1 ActiveDown HGradient 8 grey black
ButtonStyle All -- UseTitleStyle
AddButtonStyle 1 \
ActiveUp (Pixmap a.xpm) \
ActiveDown (Pixmap b.xpm -- Top)
AddButtonStyle 1 Vector 4 50x30@1 70x70@0 30x70@0 50x30@1

 

Initially for this example all button states are set to a pixmap. The second line replaces the
"ActiveDown" state with a gradient (it overrides the pixmap assigned to it in the line before, which
assigned the same style to every state). Then, the UseTitleStyle flag is set for all buttons, which
causes fvwm to draw any styles set with TitleStyle before drawing the buttons. Finally,
AddButtonStyle is used to place additional pixmaps for both "ActiveUp" and "ActiveDown" states and a
vector button style is drawn on top of all states.

AddTitleStyle [state] [style] [-- [!]flag ...]

Adds a title style to the title-bar. state can be "ActiveUp", "ActiveDown", "InactiveUp" or
"InactiveDown", or "Active" (the same as both "ActiveUp" and "ActiveDown") or "Inactive" (the same as
both "InactiveUp" and "InactiveDown") or any of these 6 with "Toggled" prepended. If state is
omitted, then the style is added to every state. If the style and flags are enclosed in parentheses,
then multiple state definitions can be placed on a single line. This command is quite similar to the
AddButtonStyle command.

Title-bars are drawn in the order of definition, beginning with the most recent TitleStyle, followed
by those added with AddTitleStyle. To clear the title style stack, change style flags, or for the
descriptions of available styles and flags, see the TitleStyle and ButtonStyle commands.

AddToDecor decor

This command is deprecated and will be removed in the future. There are plans to replace it with a
more flexible solution in fvwm-3.0.

Add or divert commands to the decor named decor. A decor is a name given to the set of commands which
affect button styles, title-bar styles and border styles. If decor does not exist it is created;
otherwise the existing decor is modified. Note: Earlier versions allowed to use the HilightColor,
HilightColorset and WindowFont commands in decors. This is no longer possible. Please use the Style
command with the Hilight... and Font options.

New decors start out exactly like the "default" decor without any style definitions. A given decor
may be applied to a set of windows with the UseDecor option of the Style command. Modifying an
existing decor affects all windows which are currently assigned to it.

AddToDecor is similar in usage to the AddToMenu and AddToFunc commands, except that menus and
functions are replaced by ButtonStyle, AddButtonStyle, TitleStyle, AddTitleStyle and BorderStyle
commands. Decors created with AddToDecor can be manipulated with ChangeDecor, DestroyDecor,
UpdateDecor and the Style option.

The following example creates a decor "FlatDecor" and style "FlatStyle". They are distinct entities:

 

AddToDecor FlatDecor
+ ButtonStyle All Active (-- flat) Inactive (-- flat)
+ TitleStyle -- flat
+ BorderStyle -- HiddenHandles NoInset

 

 

Style FlatStyle \
UseDecor FlatDecor, HandleWidth 4, ForeColor white, \
BackColor grey40, HilightFore black, HilightBack grey70

 

 

Style xterm UseStyle FlatStyle

 

An existing window's decor may be reassigned with ChangeDecor. A decor can be destroyed with
DestroyDecor.

 

DestroyDecor FlatDecor
AddToDecor FlatDecor ...

 

 

Style FlatStyle UseDecor FlatDecor

 

and now apply the style again:

 

Style xterm UseStyle FlatStyle

 

# BorderStyle state [style] [--[!]flag ...]

定义边框样式。

state

"Active", "Inactive"。如果忽略,则同时为二者。如果style和flag在括号中,则可以每行指定多个state值。

style

可用按钮样式的子集。并且只能是TiledPixmap(与斜角颜色相匹配的均匀像素图以这种方式效果最佳)或者Colorset。如果没用指定style,则可以在不重置style的情况下,修改flag值。

flag

如果以`!`为前缀,则表示相反效果。

HiddenHandles 隐藏四个角(对!Handles窗口无效),但是作用还在。默认禁用。
NoInset 补充HiddenHandles,不再绘制内斜面。趋向于扁平
Raised 升起(default).
Sunk 下沉
Flat 扁平

To decorate the active and inactive window borders with a textured pixmap, one might specify:

 

BorderStyle Active TiledPixmap marble.xpm
BorderStyle Inactive TiledPixmap granite.xpm
BorderStyle Active -- HiddenHandles NoInset

 

To clear the style for both states:

 

BorderStyle Simple

 

To clear for a single state:

 

BorderStyle Active Simple

 

To unset a flag for a given state:

 

BorderStyle Inactive -- !NoInset

 

标题栏按钮可以使用ButtonStyleUseBorderStyle边框样式。

ButtonState [ActiveDown bool] [Inactive bool] [InactiveDown bool]

The ButtonState command controls which states of the window titles and title buttons are used. The
default is to use all four states: "ActiveUp", "ActiveDown", "InactiveUp" and "InactiveDown" (see
ButtonStyle and TitleStyle commands). The bool argument after the key word controls if the designated
state is used ("True") or not ("False"). The bool flag is the same as other commands, and not limited
to just "True" or "False"; "Yes" and "No" may also be used. The "ActiveUp" state cannot be
deactivated. If no arguments are provided or the given arguments are illegal, the default is
restored.

If ActiveDown argument is "False", no different button style for the pressed down buttons used,
instead "ActiveUp" state is used even when button is pressed.

If Inactive argument is "False", focused and unfocused windows look similarly, the corresponding
"Active" states are always used.

If InactiveDown argument is "False" (only applied when Inactive is "True"), the pressed titles and
title buttons in non-focused windows are drawn using "InactiveUp" or "ActiveUp" states depending on
the values of the other key words.

ButtonStyle button [state] [style] [-- [!]flag ...]

Sets the button style for a title-bar button. button is the title-bar button number between 0 and 9,
or one of "All", "Left", "Right", or "Reset". Button numbering is described in the Mouse command
section. If the style and flags are enclosed in parentheses, then multiple state definitions can be
specified per line.

state refers to which button state should be set. Button states are defined as follows: "ActiveUp"
and "ActiveDown" refer to the un-pressed and pressed states for buttons on active windows; while the
"InactiveUp" and "InactiveDown" states denote buttons on inactive windows. The shortcut "Active"
denotes both "ActiveUp" and "ActiveDown" states. Shortcut "Inactive" denotes both "InactiveUp" and
"InactiveDown" states. The similar state names like just described, but with the "Toggled" prefix are
used instead for title buttons which have one of the MwmDecorMax, MwmDecorShade, MwmDecorStick or
MwmDecorLayer hints, if the window is maximized, shaded, sticky or placed on specific layer,
respectively.

 

AddToDecor Default
+ ButtonStyle 6 \
Vector 4 50x25@1 85x75@0 15x75@0 50x25@1
+ ButtonStyle 6 ToggledActiveUp \
Vector 4 50x75@0 85x25@1 15x25@0 50x75@0
+ ButtonStyle 6 ToggledActiveDown \
Vector 4 50x75@0 85x25@1 15x25@0 50x75@0
+ ButtonStyle 6 ToggledInactive \
Vector 4 50x75@0 85x25@1 15x25@0 50x75@0
+ ButtonStyle 6 - MwmDecorShade
Mouse 0 6 N WindowShade

 

Additionally, the following shortcuts may be used: "AllNormal", "AllToggled", "AllActive",
"AllInactive", "AllUp", "AllDown". They are actually different masks for 4 individual states from 8
total. These are supported too: "AllActiveUp", "AllActiveDown", "AllInactiveUp", "AllInactiveDown".

If state is specified, that particular button state is set. If state is omitted, every state is set.
Specifying a style destroys the current style (use AddButtonStyle to avoid this).

If style is omitted, then state-dependent flags can be set for the primary button style without
destroying the current style. Examples (each line should be considered independent):

 

ButtonStyle Left -- flat
ButtonStyle All ActiveUp (-- flat) Inactive (-- flat)

 

The first line sets every state of the left buttons to flat, while the second sets only the "ActiveUp"
and "Inactive" states of every button to flat (only flags are changed; the buttons' individual styles
are not changed).

If you want to reset all buttons to their defaults:s

 

ButtonStyle Reset

 

To reset the "ActiveUp" button state of button 1 to the default:

 

ButtonStyle 1 ActiveUp Default

 

To reset all button states of button 1 to the default of button number 2:

 

ButtonStyle 1 Default 2

 

For any button, multiple state definitions can be given on one line by enclosing the style and flags
in parentheses. If only one definition per line is given the parentheses can be omitted.

flags affect the specified state. If a '!' is prefixed to any flag, its behavior is negated. The
available state-dependent flags for all styles are described here (the ButtonStyle entry deals with
state-independent flags).

Raised causes a raised relief pattern to be drawn.

Sunk causes a sunken relief pattern to be drawn.

Flat inhibits the relief pattern from being drawn.

UseTitleStyle causes the given button state to render the current title style before rendering the
buttons' own styles. The Raised, Flat and Sunk TitleStyle flags are ignored since they are redundant
in this context.

UseBorderStyle causes the button to inherit the decorated BorderStyle options.

Raised, Sunk and Flat are mutually exclusive, and can be specified for the initial ButtonStyle only.
UseTitleStyle and UseBorderStyle are also mutually exclusive (both can be off however). The default
is Raised with both UseBorderStyle and UseTitleStyle left unset.

Important
for the "ActiveDown" and "InactiveDown" states: When a button is pressed, the relief is inverted.
Because of this, to obtain the raised look in "ActiveDown" or "InactiveDown" states you must specify
the opposite of the desired relief (i.e. Sunk for "ActiveDown" or "InactiveDown"). This behavior is
consistent, but may seem confusing at first. The same applies to the "Toggled" states.

Button styles are classified as non-destructive, partially destructive, or fully destructive.
Non-destructive styles do not affect the image. Partially destructive styles can obscure some or all
parts of the underlying image (i.e. Pixmap). Fully destructive styles obscure the entire underlying
image (i.e. Solid or one of the gradient styles). Thus, if stacking styles with AddButtonStyle (or
AddTitleStyle for title-bars), use care in sequencing styles to minimize redraw.

The available styles are:

Simple, Default, Solid, Colorset, Vector, ?Gradient, Pixmap, AdjustedPixmap, ShrunkPixmap, StretchedPixmap, TiledPixmap, MiniIcon

The description of these styles and their arguments follow:

The Simple style does nothing. There are no arguments, and this style is an example of a
non-destructive button style.

The Default style conditionally accepts one argument: a number which specifies the default button
number to load. If the style command given is ButtonStyle or AddButtonStyle, the argument is optional
(if given, it overrides the current button). If a command other than ButtonStyle or AddButtonStyle is
used, the number must be specified.

The Solid style fills the button with a solid color. The relief border color is not affected. The
color is specified as a single argument. This style is fully destructive.

The Colorset cs [alpha] style fills the button with the Colorset cs. The optional alpha argument is a
percentage between 0 and 100. It causes fvwm to merge the colorset background onto the button using
this percentage. If the percentage is 0 the colorset background is hidden and if it is 100 the
colorset background is fully applied. The default is 100. So, the destructiveness depends on the
alpha argument.

The Vector num X[offsetp]xY[offsetp]@C ... style draws a line pattern. Since this is a standard
button style, the keyword Vector is optional, num is a number of point specifications of the form
X[offsetp]xY[offsetp]@C ... X and Y are point coordinates inside the button, given in percents (from
0 to 100). An optional absolute offset in pixels, can be given as "+<offset>p" for a positive or
"-<offset>p" for a negative offset.

C specifies a line color (0 - the shadow color, 1 - the highlight color, 2 - the background color, 3 -
the foreground color, 4 - only move the point, do not draw). The first point color is not used. You
can use up to 10000 points in a line pattern. This style is partially destructive.

The specification is a little cumbersome:

 

ButtonStyle 2 Vector 4 50x30@1 70x70@0 30x70@0 50x30@1

 

then the button 2 decoration uses a 4-point pattern consisting of a line from (x=50,y=30) to (70,70)
in the shadow color (@0), and then to (30,70) in the shadow color, and finally to (50,30) in the
highlight color (@1). Is that too confusing? See the fvwm web pages for some examples with
screenshots.

A more complex example of Vector:

 

ButtonStyle 8 Vector 10 45x65@2 45x75@3 \
20x75@3 20x50@3 35x50@3 35x65@1 35x25@1 \
75x25@1 75x65@0 35x65@0
ButtonStyle 0 Vector 10 45x65@2 45x75@0 \
20x75@0 20x50@1 45x50@1 45x65@0 75x65@3 \
75x25@3 35x25@3 35x47@3

 

The ?Gradient styles denote color gradients. Fill in the question mark with any one of the defined
gradient types. Please refer to the Color Gradients section for a description of the gradient syntax.
The gradient styles are fully destructive.

The Pixmap style displays a pixmap. A pixmap should be specified as an argument. For example, the
following would give button number 2 the same pixmap for all 4 states (2 active and 2 inactive), and
button number 4 all different pixmaps.

 

ButtonStyle 2 Pixmap my_pixmap.xpm
ButtonStyle 4 \
ActiveUp (Pixmap activeup.xpm) \
ActiveDown (Pixmap activedown.xpm) \
Inactive (Pixmap inactiveup.xpm)
ButtonStyle 4 \
InactiveDown Pixmap inactivedown.xpm

 

The pixmap specification can be given as an absolute or relative pathname (see ImagePath). If the
pixmap cannot be found, the button style reverts to Simple. Flags specific to the Pixmap style are
Left, Right, Top, and Bottom. These can be used to justify the pixmap (default is centered for both
directions). Pixmap transparency is used for the color "None." This style is partially destructive.

The AdjustedPixmap style is similar to the Pixmap style. But the image is resized to exactly fit the
button.

The ShrunkPixmap style is similar to the Pixmap style. But if the image is bigger than the button the
image is resized to fit into the button.

The StretchedPixmap style is similar to the Pixmap style. But if the image is smaller than the button
the image is resized to cover the button.

The TiledPixmap style accepts a pixmap to be tiled as the button background. One pixmap is specified
as an argument. Pixmap transparency is not used. This style is fully destructive.

The MiniIcon style draws the window's miniature icon in the button, which is specified with the
MiniIcon option of the Style command. This button style accepts no arguments. Example:

 

Style * MiniIcon mini-bx2.xpm
Style xterm MiniIcon mini-term.xpm
Style Emacs MiniIcon mini-doc.xpm

 

 

ButtonStyle 1 MiniIcon

 

ButtonStyle button - [!]flag ...

Sets state-independent flags for the specified button. State-independent flags affect button
behavior. Each flag is separated by a space. If a '!' is prefixed to the flag then the behavior is
negated. The special flag Clear clears any existing flags.

The following flags are usually used to tell fvwm which buttons should be affected by mwm function
hints (see MwmFunctions option of the Style command. This is not done automatically since you might
have buttons bound to complex functions, for instance.

MwmDecorMenu should be assigned to title-bar buttons which display a menu. The default assignment is
the leftmost button. When a window with the MwmFunctions Style option requests not to show this
button, it is hidden.

MwmDecorMin should be assigned to title-bar buttons which minimize or iconify the window. The default
assignment is the second button over from the rightmost button. When a window with the MwmFunctions
Style option requests not to show this button, it is hidden.

MwmDecorMax should be assigned to title-bar buttons which maximize the window. The default assignment
is the rightmost button. When a window with the MwmFunctions Style option requests not to show this
button, it is hidden. When the window is maximized, the vector pattern on the button looks pressed
in.

MwmDecorShade should be assigned to title-bar buttons which shade the window (see WindowShade
command). When the window is shaded, the vector pattern on the button looks pressed in.

MwmDecorStick should be assigned to title-bar buttons which make the window sticky. When the window
is sticky, the vector pattern on the button looks pressed in.

The flag MwmDecorLayer layer should be assigned to title-bar buttons which place the window in the
layer numbered layer. When the window is on that specific layer, the vector pattern on the button
looks pressed in.

ChangeDecor decor

This command is deprecated and will be removed in the future. There are plans to replace it with a
more flexible solution in fvwm-3.0.

Changes the decor of a window to decor. decor is "Default" or the name of a decor defined with
AddToDecor. If decor is invalid, nothing occurs. If called from somewhere in a window or its border,
then that window is affected. If called from the root window the user is allowed to select the target
window. ChangeDecor only affects attributes which can be set using the AddToDecor command.

 

ChangeDecor CustomDecor1

 

DestroyDecor [recreate] decor

This command is deprecated and will be removed in the future. There are plans to replace it with a
more flexible solution in fvwm-3.0.

Deletes the decor defined with AddToDecor, so that subsequent references to it are no longer valid.
Windows using this decor revert to the "Default" decor. The optional parameter recreate tells fvwm
not to throw away the decor completely but to throw away only its contents. If the decor is created
again later, windows do not use it before the UseDecor style is applied again unless the decor was
destroyed with the recreate option. The decor named "Default" cannot be destroyed.

 

DestroyDecor CustomDecor1

 

TitleStyle [justification] [Height [num]] [MinHeight [num]]

Sets attributes for the title-bar. Justifications can be Centered, RightJustified or LeftJustified.
Height sets the title bar's height to an amount in pixels. MinHeight sets the minimal height in
pixels of the title bar. Defaults are Centered, the window's font height and no minimal height. To
reset the font height to the default value, omit the num argument after the Height keyword. The
MinHeight height is reset by Height or if given with no argument. Example:

 

TitleStyle LeftJustified Height 24

 

TitleStyle [state] [style] [-- [!]flag ...]

Sets the style for the title-bar. See also AddTitleStyle and ButtonStyle state can be one of
"ActiveUp", "ActiveDown", "InactiveUp", or "InactiveDown". Shortcuts like "Active" and "Inactive" are
allowed. The states with the "Toggled" prefix are allowed too, the title itself does not use
"Toggled" states, but these states are used for the buttons with ButtonStyle UseTitleStyle. If state
is omitted, then the style is added to every state. If parentheses are placed around the style and
flags, then multiple state definitions can be given per line. style can be omitted so that flags can
be set while not destroying the current style.

If a '!' is prefixed to any flag, its behavior is negated. Valid flags for each state include
Raised, Flat and Sunk (these are mutually exclusive). The default is Raised. See the note in
ButtonStyle regarding the "ActiveDown" state. Examples:

 

TitleStyle ActiveUp HGradient 16 navy black
TitleStyle \
ActiveDown (Solid red -- flat) \
Inactive (TiledPixmap wood.xpm)
TitleStyle \
ActiveUp (-- Flat) \
ActiveDown (-- Raised) \
InactiveUp (-- Flat) \
InactiveDown (-- Sunk)

 

This sets the "ActiveUp" state to a horizontal gradient, the "ActiveDown" state to solid red, and the
"Inactive" states to a tiled wood pixmap. Finally, "ActiveUp" and "InactiveUp" are set to look flat,
while "ActiveDown" set to be sunk (the Raised flag for the "ActiveDown" state causes it to appear sunk
due to relief inversion), and "InactiveDown" is set to look raised. An example which sets flags for
all states:

 

TitleStyle -- flat

 

For a flattened look:

 

TitleStyle -- flat
ButtonStyle All Active (-- flat) Inactive (-- flat)

 

TitleStyle accepts all the ButtonStyle styles and arguments:

Simple, Default, Solid, Colorset, Vector, ?Gradient, Pixmap, AdjustedPixmap, ShrunkPixmap,
StretchedPixmap, TiledPixmap, MiniIcon.

See the ButtonStyle command for a description of all these styles and their arguments.

In addition to these styles TitleStyle accepts a powerful MultiPixmap option. This allows you to
specify different pixmaps, colorsets or colors for different parts of the titlebar. Some of them are
tiled or stretched to fit a particular space; others are discrete "transition" images. The definable
sections are:

Main

The full titlebar

 

LeftMain

Left of title text

 

RightMain

Right of title text

 

UnderText

Underneath title text

 

LeftOfText

just to the left of the title text

 

RightOfText

just to the right of the title text

 

LeftEnd

at the far left end of the titlebar (just after left buttons if any)

 

RightEnd

at the far right end of the titlebar (just before right buttons if any)

 

Buttons

under buttons in case of UseTitleStyle

 

LeftButtons

under left buttons in case of UseTitleStyle

 

RightButtons

under right buttons in case of UseTitleStyle

 

None of these are mandatory except for Main (or, if you do not define Main you must define both
LeftMain and RightMain). If no Buttons pixmaps are defined and UseTitleStyle is specified for one or
more buttons, Main, LeftMain or RightMain are used as appropriate.

The syntax for this style type is:

 

MultiPixmap section style arg, ...

 

continuing for whatever you want to define. The style can be either TiledPixmap, AdjustedPixmap,
Colorset or Solid. See the ButtonStyle command for the description of these styles. In the case of a
transition section, LeftEnd, LeftOfText, RightOfText or RightEnd, AdjustedPixmap only resize the
pixmap in the "y" direction. For the Colorset and Solid styles a width of the half of the title bar
height is assumed for the transition sections.

An example:

 

MultiPixmap Main AdjustedPixmap foo.xpm, \
UnderText TiledPixmap bar.xpm, \
Buttons Colorset 2

 

Note that the old syntax is still supported: if the style is omitted, TiledPixmap is assumed and
adding "(stretched)" between the section and the file name implies AdjustedPixmap.

UpdateDecor [decor]

This command is deprecated and will be removed in the future. There are plans to replace it with a
more flexible solution in fvwm-3.0.

This command is kept mainly for backward compatibility. Since all elements of a decor are updated
immediately when they are changed, this command is mostly useless.

Updates window decorations. decor is an optional argument which specifies the decor to update. If
given, only windows which are assigned to that particular decor are updated. This command is useful,
for instance, after a ButtonStyle, TitleStyle or BorderStyle (possibly used in conjunction with
AddToDecor). Specifying an invalid decor results in all windows being updated. This command is less
disturbing than Recapture, but does not affect window style options as Recapture does.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值