# AddToFunc

`AddToFunc` name I J M C H D action

Begins or adds to a function definition. Here is an example:

    AddToFunc Move-or-Raise I
     + M
     + D

The function name is "Move-or-Raise", and it could be invoked from a menu or a mouse binding or key binding:

     1 TS A Move-or-Raise

The name 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 action tells what kind of action triggers the command which follows it. '' stands for "Immediate", and is executed as soon as the function is invoked. '' 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. '' stands for "Motion", i.e. if the user starts moving the mouse. '' stands for "Click", i.e., if the user presses and releases the mouse button. '' stands for "Hold", i.e. if the user presses a mouse button and holds it down for more than milliseconds. '' stands for "Double-click". The action 'I' causes an action to be performed on the button-press, if the function is invoked with prior knowledge of which window to act on.

There is a number of predefined symbols that are replaced by certain values if they appear on the command line. Please refer to the section for details.

Please read the comments on executing complex functions in the section .

Examples:

If you call

     F10 R A  MailFunction xmh "-font fixed"

and "MailFunction" is

    AddToFunc MailFunction
     + I  ($0)  off
     + I  (AcceptsFocus, $0)
     + I  ($0)  exec $0 $1

Then the last line of the function becomes

     + I  (xmh)  exec xmh -font fixed

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

     F11 R A  MailFunction zmail "-bg pink"

in the same `config`, if you wanted. An example of using "$[w.id]" is:

    AddToFunc PrintFunction
     + I
     + I  xdpr -id $[w.id]

Note that "$$" is expanded to '$'.

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:

    AddToFunc FuncIconifySameResource "I"  ($0)  on
     3 6 A FuncIconifySameResource $[w.resource]