fvwm 鼠标键盘鼠标滑动 命令绑定

Mouse, Key & Stroke Bindings


31.6.1. IgnoreModifiers


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.
31.6.2. EdgeCommand


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.


31.6.3. EdgeLeaveCommand


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.


31.6.4. GnomeButton


GnomeButton


Used in conjunction with Mouse to pass mouse button presses on the root window to a GNOME program (such as GMC). The following example passes presses of mouse buttons 1 and 3 to such a program.


Mouse 1 R A GnomeButton
Mouse 3 R A GnomeButton
31.6.5. Key


Key [(window)] Keyname Context Modifiers Function


Binds a keyboard key to a specified fvwm command, or removes the binding if Function is '-'. The syntax is the same as for a Mouse binding except that the mouse button number is replaced with a Keyname. Normally, the key binding is activated when the key is pressed. Keyname is a standard X11 key name as defined in /usr/include/X11/keysymdef.h, (without the XK_ prefix), or the keysym database /usr/X11R6/lib/X11/XKeysymDB. Only key names that are generated with no modifier keys or with just the Shift key held are guaranteed to work. The Context and Modifiers fields are defined as in the Mouse binding. However, when you press a key the context window is the window that has the keyboard focus. That is not necessarily the same as the window the pointer is over (with SloppyFocus or ClickToFocus). Note that key bindings with the 'R' (root window) context do not work properly with SloppyFocus and ClickToFocus. If you encounter problems, use the PointerKey command instead. If you want to bind keys to a window with SloppyFocus or ClickToFocus that are supposed to work when the pointer is not over the window, fvwm assumes the pointer is over the client window (i.e. you have to use the 'W' context).


The special context 'M' for menus can be used to (re)define the menu controls. It be used alone or together with 'T', 'S', 'I', '[', ']', '-' and '_'. See the Menu Bindings section for details.


The following example binds the built-in window list to pop up when Alt-Ctrl-Shift-F11 is hit, no matter where the mouse pointer is:


Key F11 A SCM WindowList
Binding a key to a title-bar button causes that button to appear. Please refer to the Mouse command for details.


31.6.6. Mouse


Mouse [(window)] Button Context Modifiers Function


Defines a mouse binding, or removes the binding if Function is '-'. Button is the mouse button number. If Button is zero then any button performs the specified function. Note that only mouse buttons 1 to 5 are fully supported by X11. Any number above this works only partially. Complex functions can not be used with these buttons and neither any operation that requires dragging the pointer with the button held. This is due to limitations of X11. By default, the highest allowed button number is 9.


Context describes where the binding applies. Valid contexts are 'R' for the root window, 'W' for an application window, 'D' for a desktop application (as kdesktop or Nautilus desktop), 'T' for a window title-bar, 'S' for a window side, top, or bottom bar, '[', ']', '-' and '_' for the left, right, top or bottom side only, 'F' for a window frame (the corners), '<', '^', '>' and 'v' for the top left, top right, bottom right or bottom left corner, 'I' for an icon window, or '0' through '9' for title-bar buttons, or any combination of these letters. 'A' is for any context. For instance, a context of "FST" applies when the mouse is anywhere in a window's border except the title-bar buttons. Only 'S' and 'W' are valid for an undecorated window.


The special context 'M' for menus can be used to (re)define the menu controls. It can be used alone or together with 'T', 'S', 'I', '[', ']', '-' and '_'. See the Menu Bindings section for details.


The special context 'P' controls what buttons that can be used to place a window. When using this context no modifiers are allowed (Modifiers must be N), no window is allowed, and the Function must be one of PlaceWindow, PlaceWindowDrag, PlaceWindowInteractive, CancelPlacement, CancelPlacementDrag, CancelPlacementInteractive or -.


PlaceWindow makes Button usable for window placement, both for interactive and drag move. CancelPlacement does the inverse. That is makes Button to cancel move for both interactive and drag move. It may however not override how new windows are resized after being placed. This is controlled by the Emulate command. Also a window being dragged can always be placed by releasing the button hold while dragging, regardless of if it is set to PlaceWindow or not.


PlaceWindowDrag and PlaceWindowInteractive/CancelPlacementDrag and CancelPlacementInteractive work as PlaceWindow/CancelPlacement with the exception that they only affect either windows dragged / placed interactively.


- is equivalent to CancelPlacement.


The following example makes all buttons but button 3 usable for interactive placement and makes drag moves started by other buttons than one cancel if button 1 is pressed before finishing the move:


Mouse 0 P N PlaceWindow
Mouse 3 P N CancelPlacement
Mouse 1 P N CancelPlacementDrag
By default, the binding applies to all windows. You can specify that a binding only applies to specific windows by specifying the window name in brackets. The window name is a wildcard pattern specifying the class, resource or name of the window you want the binding to apply to.


The following example shows how the same key-binding can be used to perform different functions depending on the window that is focused:


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
A '--' action indicates that the event should be propagated to the specified window to handle. This is only a valid action for window-specific bindings.


This example shows how to display the WindowList when Button 3 is pressed on an rxvt window:


Mouse (rxvt) 3 A A WindowList
Note that Fvwm actually intercepts all events for a window-specific binding and (if the focused window doesn't match any of the bindings) sends a synthetic copy of the event to the window. This should be transparent to most applications, however (for security reasons) some programs ignore these synthetic events by default - xterm is one of them. To enable handling of these events, add the following line to your ~/.Xdefaults file:


XTerm*allowSendEvents:  true
Modifiers is any combination of 'N' for no modifiers, 'C' for control, 'S' for shift, 'M' for Meta, 'L' for Caps-Lock or 'A' for any modifier. For example, a modifier of "SM" applies when both the Meta and Shift keys are down. X11 modifiers mod1 through mod5 are represented as the digits '1' through '5'. The modifier 'L' is ignored by default. To turn it on, use the IgnoreModifiers command.


Function is one of fvwm's commands.


The title-bar buttons are numbered with odd numbered buttons on the left side of the title-bar and even numbers on the right. Smaller-numbered buttons are displayed toward the outside of the window while larger-numbered buttons appear toward the middle of the window (0 is short for 10). In summary, the buttons are numbered:


1 3 5 7 9    0 8 6 4 2
The highest odd numbered button which has an action bound to it determines the number of buttons drawn on the left side of the title bar. The highest even number determines the number of right side buttons which are drawn. Actions can be bound to either mouse buttons or keyboard keys.


31.6.7. PointerKey


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
31.6.8. Stroke


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/


31.6.9. StrokeFunc


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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值