1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
<?xml version="1.0" encoding="UTF-8" ?>
<!-- $Id$ -->
<!DOCTYPE part PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"../docbook-xml/docbookx.dtd"
[
<!ENTITY % myents SYSTEM "../fvwm.ent" >
%myents;
]>
<section id='AddToFunc'>
<title>AddToFunc</title>
<cmdsynopsis>
<command>AddToFunc</command
><arg choice='opt'
><replaceable>name</replaceable
><arg choice='opt'
><group choice='plain'
><arg choice='plain'>I</arg
><arg choice='plain'>J</arg
><arg choice='plain'>M</arg
><arg choice='plain'>C</arg
><arg choice='plain'>H</arg
><arg choice='plain'>D</arg
></group
><arg choice='plain'
><replaceable>action</replaceable
></arg
></arg
></arg>
</cmdsynopsis>
<para>Begins or adds to a function definition. Here is an example:</para>
<programlisting>
AddToFunc Move-or-Raise I <fvwmref cmd="Raise"/>
+ M <fvwmref cmd="Move"/>
+ D <fvwmref cmd="Lower"/>
</programlisting>
<para>The function name is "Move-or-Raise", and it could be invoked from a
menu or a mouse binding or key binding:</para>
<programlisting>
<fvwmref cmd="Mouse"/> 1 TS A Move-or-Raise
</programlisting>
<para>The
<replaceable>name</replaceable>
must not contain embedded whitespace. No guarantees are made
whether function names with embedded whitespace work or not. This
behavior may also change in the future without further notice.
The letter before the
<replaceable>action</replaceable>
tells what kind of action triggers the command which follows it.
'<fvwmopt cmd="AddToFunc" opt="I"/>'
stands for "Immediate", and is executed as soon as the function is
invoked.
'<fvwmopt cmd="AddToFunc" opt="J"/>'
is similar to "Immediate" but is delayed until a button is pressed
or released or the pointer is moved, or the function completes. It
is always executed before the other function actions.
'<fvwmopt cmd="AddToFunc" opt="M"/>'
stands for "Motion", i.e. if the user starts moving the mouse.
'<fvwmopt cmd="AddToFunc" opt="C"/>'
stands for "Click", i.e., if the user presses and releases the
mouse button.
'<fvwmopt cmd="AddToFunc" opt="H"/>'
stands for "Hold", i.e. if the user presses a mouse button and
holds it down for more than
<fvwmref cmd="ClickTime"/>
milliseconds.
'<fvwmopt cmd="AddToFunc" opt="D"/>'
stands for "Double-click". The action
'<emphasis remap='I'>I</emphasis>'
causes an action to be performed on the button-press, if the
function is invoked with prior knowledge of which window to act
on.</para>
<para>There is a number of predefined symbols that are replaced by
certain values if they appear on the command line. Please refer
to the
<fvwmref sect="expansion" opt="command_expansion" name="Command Expansion"/>
section for details.</para>
<warning>Please read the comments on executing complex functions
in the section
<fvwmref sect="scripting" opt="scripting_and_complex_functions" name="Scripting and Complex Functions"/>.
</warning>
<para>Examples:</para>
<para>If you call</para>
<programlisting>
<fvwmref cmd="Key"/> F10 R A <fvwmref cmd="Function"/> MailFunction xmh "-font fixed"
</programlisting>
<para>and "MailFunction" is</para>
<programlisting>
AddToFunc MailFunction
+ I <fvwmref cmd="Next"/> ($0) <fvwmref cmd="Iconify"/> off
+ I <fvwmref cmd="Next"/> (AcceptsFocus, $0) <fvwmref cmd="Focus"/>
+ I <fvwmref cmd="None"/> ($0) <fvwmref cmd="Exec"/> exec $0 $1
</programlisting>
<para>Then the last line of the function becomes</para>
<programlisting>
+ I <fvwmref cmd="None"/> (xmh) <fvwmref cmd="Exec"/> exec xmh -font fixed
</programlisting>
<para>The expansion is performed as the function is executed, so you can
use the same function with all sorts of different arguments. You
could use</para>
<programlisting>
<fvwmref cmd="Key"/> F11 R A <fvwmref cmd="Function"/> MailFunction zmail "-bg pink"
</programlisting>
<para>in the same
<filename>config</filename>,
if you wanted. An example of using "$[w.id]" is:</para>
<programlisting>
AddToFunc PrintFunction
+ I <fvwmref cmd="Raise"/>
+ I <fvwmref cmd="Exec"/> xdpr -id $[w.id]
</programlisting>
<para>Note that "$$" is expanded to '$'.</para>
<para>Another example: bind right mouse button within the window button
number 6 (this is a minimize button for the win95 theme) to
iconify all windows of the same resource:</para>
<programlisting>
AddToFunc FuncIconifySameResource "I" <fvwmref cmd="All"/> ($0) <fvwmref cmd="Iconify"/> on
<fvwmref cmd="Mouse"/> 3 6 A FuncIconifySameResource $[w.resource]
</programlisting>
</section>
|