「FVWM」 – 鼠标、键盘、手势的绑定

  CREATED BY JENKINSBOT

IgnoreModifiers [Modifiers]

Tells fvwm which modifiers to ignore when matching Mouse or Key bindings. IgnoreModifiers affects the

ClickToFocus style too. This command belongs into your config. If you issue it when your fvwm

session is already up and running the results are unpredictable. The should appear before any

applications or modules are started in your config file (e.g. with the Exec command).

Modifiers has the same syntax as in the Mouse or Key bindings, with the addition of ‘L’ meaning the

caps lock key. The default is “L”. Modifiers can be omitted, meaning no modifiers are ignored. This

command comes in handy if the num-lock and scroll-lock keys interfere with your shortcuts. With

XFree86 ‘2’ usually is the num-lock modifier and ‘5’ refers to the scroll-lock key. To turn all these

pesky modifiers off you can use this command:

IgnoreModifiers L25

If the Modifiers argument is the string “default”, fvwm reverts back to the default value “L”.

Important

This command creates a lot of extra network traffic, depending on your CPU, network connection, the

number of Key or Mouse 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. I.e. do not ignore scroll-lock if you have no problem with it. In the FAQ you

can find a better solution of this problem.

EdgeCommand [direction [Function]]

Binds a specified fvwm command Function to an edge of the screen. Direction may be one of “North”,

“Top”, “West”, “Left”, “South”, “Bottom”, “Right” and “East”. If Function is omitted the binding for

this edge is removed. If EdgeCommand is called without any arguments all edge bindings are removed.

Function is executed when the mouse pointer enters the invisible pan frames that surround the visible

screen. The binding works only if EdgeThickness is set to a value greater than 0. If a function is

bound to an edge, scrolling specified by EdgeScroll is disabled for this edge. It is possible to bind

a function only to some edges and use the other edges for scrolling. This command is intended to

raise or lower certain windows when the mouse pointer enters an edge. FvwmAuto can be used get a

delay when raising or lowering windows. The following example raises FvwmButtons if the mouse pointer

enters the top edge of the screen.

# Disable EdgeScrolling but make it possible

# to move windows over the screen edge

EdgeResistance -1

Style * EdgeMoveDelay 250

Style * EdgeMoveResistance 20

# Set thickness of the edge of the screen to 1

EdgeThickness 1

# Give focus to FvwmButtons if the mouse

# hits top edge

EdgeCommand Top Next (FvwmButtons) Focus

# Make sure the Next command matches the window

Style FvwmButtons CirculateHit

Module FvwmButtons

Module FvwmAuto 100 “Silent AutoRaiseFunction” \
“Silent AutoLowerFunction”

# If any window except FvwmButtons has

# focus when calling this function

# FvwmButtons are lowered

DestroyFunc AutoLowerFunction

AddToFunc AutoLowerFunction

+ I Current (!FvwmButtons) All (FvwmButtons) Lower

# If FvwmButtons has focus when calling this function raise it

DestroyFunc AutoRaiseFunction

AddToFunc AutoRaiseFunction

+ I Current (FvwmButtons) Raise

Normally, the invisible pan frames are only on the screen edges that border virtual pages. If a

screen edge has a command bound to it, the pan frame is always created on that edge.

EdgeLeaveCommand [direction [Function]]

Binds a specified fvwm command Function to an edge of the screen. Direction may be one of “North”,

“Top”, “West”, “Left”, “South”, “Bottom”, “Right” and “East”. If Function is omitted the binding for

this edge is removed. If EdgeLeaveCommand is called without any arguments all edge bindings are

removed.

Function is executed when the mouse pointer leaves the invisible pan frames that surround the visible

screen. The binding works only if EdgeThickness is set to a value greater than 0. If a function is

bound to an edge, scrolling specified by EdgeScroll is disabled for this edge. It is possible to bind

a function only to some edges and use the other edges for scrolling. This command is intended to

raise or lower certain windows when the mouse pointer leaves an edge. FvwmAuto can be used get a

delay when raising or lowering windows. See example for EdgeCommand

Normally, the invisible pan frames are only on the screen edges that border virtual pages. If a

screen edge has a command bound to it, the pan frame is always created on that edge.

Key [(window)] Keyname Context Modifiers Function

将键盘键绑定到指定的FVWM命令。语法与Mouse绑定的语法相同,只是用Keyname替换了鼠标按钮编号。通常,按下键时激活键绑定。

Keyname,是/usr/include/X11/keysymdef.h中定义的标准X11键名(没有XK_前缀),或keysym数据库/usr/X11R6/lib/X11/XKeysymDB。只保证在”没有修饰键“或”仅保持Shift键“的情况下生成的键名可以正常工作。

Context,该字段如同在Mouse绑定中的定义,指的是上下文窗口。但是,按下某个键时,上下文窗口是具有键盘焦点的窗口。这不一定与指针所在的窗口相同(使用SloppyFocus或ClickToFocus)。请注意,使用“R”(根窗口)上下文的键绑定无法与SloppyFocus和ClickToFocus一起正常工作。如果遇到问题,请改用PointerKey命令。如果要将键绑定到具有SloppyFocus或ClickToFocus的窗口,当指针不在窗口上时,该窗口应该起作用,fvwm假定指针位于客户端窗口上(即,您必须使用’W’上下文)。菜单的特殊上下文“M”可用于(重新)定义菜单控件。它可以单独使用,也可以与’T’,’S’,’I’,'[‘,’]’,’-‘和’_’一起使用。有关详细信息,请参阅“Menu绑定”部分。

Modifiers,该字段如同在Mouse绑定中的定义,修饰键,前缀键。

Function,要执行的FVWM命令。如果Function为’-‘,则删除绑定。

以下示例在按下Alt-Ctrl-Shift-F11时弹出内置窗口列表,无论鼠标指针位于何处:

Key F11 A SCM WindowList

将键绑定到标题栏按钮会导致该按钮的显示。有关详细信息,请参阅Mouse命令。

Mouse [(window)] Button Context Modifiers Function

定义鼠标绑定。

Button

Button,是鼠标按钮编号。如果Button为”0“,则任何按钮都执行指定的Function。请注意,只有鼠标按钮1到5会被X11完全支持。上述任何数字仅部分有效。复杂功能不能与这些按钮一起使用,也不能用任何需要按住按钮拖动指针的操作。这是由于X11的限制。默认情况下,允许的最高按钮数为”9“。

Context

Context,描述绑定的适用位置。有效上下文为:

  • R:根窗口
  • W:应用程序窗口
  • D:桌面应用程序(如kdesktop或Nautilus桌面)、
  • T:窗口标题栏
  • S:窗口四周(侧面、顶部、底部栏)
  • [、]、-、_:仅适用于左侧、右侧、顶部、底部
  • <、^、>、v:左上角、右上角、右下角、左下角
  • F:适用于窗框(角落)
  • I:表示图标窗口
  • 0~9:表示标题栏按钮
  • A:所有的以上情境。

这些字母字符之间可以的任何组合。例如,当鼠标位于窗口边框中的任何位置(标题栏按钮除外)时,应用“FST”上下文。只有’S’和’W’对于未修饰的窗口有效。

菜单的特殊上下文“M”可用于(重新)定义菜单控件。它可以单独使用,也可以与’T’,’S’,’I’,'[‘,’]’,’-‘和’_’一起使用。有关详细信息,请参阅“Menu绑定”部分。

特殊上下文“P”控制可用于放置窗口的按钮。使用此上下文时,不允许使用修饰符(修饰符必须为”N“),不允许使用窗口,并且Funxction必须是:PlaceWindowPlaceWindowDragPlaceWindowInteractiveCancelPlacementCancelPlacementDragCancelPlacementInteractive这七个中的一个。

PlaceWindow使Button可用于窗口放置,用于交互式和拖动移动。CancelPlacement反过来。这使得Button取消移动,以进行交互和拖动移动。但是,它可能无法覆盖放置后重新调整新窗口的大小。这由Emulate命令控制。此外,无论是否将其设置为PlaceWindow,都可以通过在拖动时释放被按住的按钮来放置被拖动的窗口。

PlaceWindowDrag、PlaceWindowInteractive/CancelPlacementDrag、CancelPlacementInteractive的作用类似于PlaceWindow/CancelPlacement,但它们仅影响以交互方式拖动/放置的窗口。

-与CancelPlacement是等价的。

以下示例使所有按钮(除了按钮3)可用于交互式放置,并且如果在完成移动之前按下按钮1可以取消,则通过其他按钮启动拖动移动而不是取消:

Mouse 0 P N PlaceWindow
Mouse 3 P N CancelPlacement
Mouse 1 P N CancelPlacementDrag

(window)

(window),默认情况下,绑定适用于所有窗口。您可以通过在括号中指定窗口名称来指定绑定仅适用于特定窗口。窗口名称是通配符模式,指定要将绑定应用于的窗口的类、资源、名称。

以下示例显示了如何使用相同的键绑定来执行不同的功能,具体取决于所关注的窗口:

Key (rxvt)  V A C Echo ctrl-V-in-RXVT
Key (*term) V A C Echo ctrl-V-in-Term
Key (*vim)  V A C --
Key         V A C Echo ctrl-V-elsewhere

“–”操作表示事件应传播到指定的窗口以进行处理。 这只是特定于窗口的绑定的有效操作。

此示例演示如何在rxvt窗口上按下按钮3时显示WindowList:

Mouse (rxvt) 3 A A WindowList

请注意,Fvwm实际上拦截了特定于窗口的绑定的所有事件,并且(如果聚焦窗口与任何绑定不匹配)将事件的合成副本发送到窗口。 这应该对大多数应用程序透明,但是(出于安全原因)某些程序默认忽略这些合成事件(xterm就是其中之一)。 要启用这些事件的处理,请将以下行添加到~/.Xdefaults文件中:

XTerm*allowSendEvents:  true

即可。

Modifiers

Modifiers,“N”表示无修饰符,“C”表示Ctrl,“S”表示Shift,“M”表示Meta,“L”表示Caps-Lock,“A”表示任何修饰符。 例如,修饰符“SM”表示当Meta键和Shift键同时按下时。X11修饰符mod1到mod5表示为数字“1”到“5”。默认情况下忽略修饰符“L”。要打开它,请使用IgnoreModifiers命令。

Function

Function,是fvwm的命令之一。或者如果Function为’-‘,则删除绑定。

标题栏按钮的编号为标题栏左侧的奇数编号按钮和右侧的偶数编号。 较小编号的按钮显示在窗口的外侧,而较大编号的按钮显示在窗口的中间(0表示10的缩写)。 总之,按钮编号为:

1 3 5 7 9 0 8 6 4 2

具有绑定动作的最高奇数编号按钮决定了标题栏左侧绘制的按钮数。具有绑定动作的最高偶数决定了绘制的右侧按钮的数量。 操作可以绑定到鼠标按钮或键盘键。

PointerKey [(window)] Keyname Context Modifiers Function

This command works exactly like the Key command. The only difference is that the binding operates on

the window under the pointer. Normal key bindings operate on the focused window instead. The

PointerKey command can for example be used to bind keys to the root window if you are using

SloppyFocus or ClickToFocus. However, some applications (xterm is one example) are unable to handle

this key anymore, even if the pointer is over the xterm window. It is recommended to use the

PointerKey command only for key combinations that are not needed in any application window.

Example:

Style * SloppyFocus

PointerKey f1 a m Menu MainMenu

Stroke [(window)] Sequence Button Context Modifiers Function

Binds a mouse stroke sequence to a specified fvwm command, or removes the binding if Function is ‘-‘.

The syntax is the same as for a Mouse binding except that Sequence is inserted in front of the button

number and a value of 0 for Button concerns the StrokeFunc command. The Context and Modifiers fields

are defined as in the Mouse binding. However, only the ‘R’ Context really works (if you want to use

other contexts you need to use the StrokeFunc below).

Strokes sequences are defined in a telephone grid like this:

1 2 3

4 5 6

7 8 9

or in a numeric pad grid like this:

7 8 9

4 5 6

1 2 3

The telephone grid is used by default, to use the numeric pad grid you should begin the sequence with

a ‘N’. Note that a complex motion may produce several different sequences (see the “netscape” example

below to handle such motion). Moreover, sequences are limited to 20 elements (with the present

version of libstroke), however, in practice it is preferable to use sequence with less than 12

elements.

Because of the default button menu in fvwm, you may need to remove a mouse button binding (using an

empty action) before using the stroke

Mouse 3 R N

Also, you can still use the stroke “sequence 0” to simulate a click:

Stroke 0 3 R N Menu WindowList Nop

The following example starts xterm when the mouse drags an ‘I’ on the root window with button 3

pressed down:

Stroke 258 3 R N Exec exec xterm

An example for Netscape:

Stroke 7415963 3 R N Exec exec netscape

Stroke 74148963 3 R N Exec exec netscape

Stroke 74158963 3 R N Exec exec netscape

Stroke 7418963 3 R N Exec exec netscape

Stroke 415963 3 R N Exec exec netscape

You may prefer to use the numeric pad grid since you have such a grid on your machine. Here an

example:

Stroke N78963214 3 R N FvwmForm FvwmForm-QuitVerify

Stroke N789632147 3 R N FvwmForm FvwmForm-QuitVerify

This example starts the “QuitVerify” form if you draw a box that begins in the top left corner.

Note: You need libstroke installed and fvwm compiled with stroke support. libstroke can be obtained

at
http://www.etla.net/~willey/projects/libstroke/

StrokeFunc [Options]

Causes fvwm to record a mouse stroke sequence and to execute the corresponding action as defined in a

Stroke command. The cursor is modified to the STROKE context of the CursorStyle command during

recording. When the stroke is finished StrokeFunc looks for a stroke binding of the form

Stroke sequence 0 Context Modifiers action

and executes the corresponding action (Note the 0). Normal use of this function is via a Mouse or Key

command. Examples:

Mouse 3 A M StrokeFunc

Key x R N StrokeFunc

If you press mouse button 3 and Alt anywhere (respectively, press the key x when the cursor is on the

root window), then fvwm records the mouse motions until the mouse button 3 (respectively, the x key)

is released and then check if the recorded sequence corresponds to a stroke binding of the form

“Stroke sequence 0 A M action”

“Stroke sequence 0 R N action”

Note that the Context and Modifiers are taken at the beginning of the execution of the StrokeFunc

command (so you can release the modifiers before the end of the stroke recording in the case of a

mouse binding and if you used, say, a title-bar context the mouse motion can go through an application

window). The keys Escape and Delete allow you to abort the command.

The StrokeFunc command has five options: NotStayPressed, EchoSequence, DrawMotion, FeedBack and

StrokeWidth. These options are disabled by default. EchoSequence causes fvwm to Echo the recorded

stroke sequence. DrawMotion causes fvwm to draw the mouse motion on the screen. FeedBack causes fvwm

to display during a fraction of second the cursor of the WAIT context of the CursorStyle command if

the recorded stroke sequence corresponds to a stroke binding. StrokeWidth takes an integer argument,

which must be >= 0 and <= 100 and which defines the width of the line for the DrawMotion option.

NotStayPressed works only if StrokeFunc is used via a Mouse or a Key command. This option removes the

need to have a button or the key pressed during the stroke, but you have to do a mouse click or press

the Return or Space key to finish the mouse motion recording (these keys also work without the

NotStayPressed option).

You can use the StrokeFunc “alone”. In this case it works as above with the NotStayPressed option

enabled. However, Modifiers, in general, may not work as expected (i.e., in this case use ‘A’ or ‘N’

as Modifiers in the stroke bindings).

Note that some computers do not support key release events. If that is the case the StrokeFunc used

via a Key command works as if the NotStayPressed option is enabled.

参考文献

Fvwm Manual/Mouse, Key & Stroke Bindings