AddToFunc [name [I | M | C | H | D action]]

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

AddToFunc Move-or-Raise I Raise

+ M Move

+ D Lower

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


Mouse 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. ‘I’

stands for “Immediate”, and is executed as soon as the function is invoked. ‘M’ stands for “Motion”,

i.e. if the user starts moving the mouse. ‘C’ stands for “Click”, i.e., if the user presses and

releases the mouse button. ‘H’ stands for “Hold”, i.e. if the user presses a mouse button and holds

it down for more than ClickTime milliseconds. ‘D’ 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 Command Expansion section for details.


Please read the comments on executing complex functions in the section Scripting and Complex



If you call

Key F10 R A Function MailFunction xmh “-font fixed”

and “MailFunction” is

AddToFunc MailFunction

+ I Next ($0) Iconify off

+ I Next (AcceptsFocus, $0) Focus

+ I None ($0) Exec exec $0 $1

Then the last line of the function becomes

+ I None (xmh) Exec 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

Key F11 R A Function MailFunction zmail “-bg pink”

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

AddToFunc PrintFunction

+ I Raise

+ I Exec 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” All ($0) Iconify on

Mouse 3 6 A FuncIconifySameResource $[w.resource]


As might be expected, this makes the terminal beep.

DestroyFunc function

Deletes a function, so that subsequent references to it are no longer valid. You can use this to

change the contents of a function during a fvwm session. The function can be rebuilt using AddToFunc.

DestroyFunc PrintFunction

Echo string

Prints a message to stderr. Potentially useful for debugging things in your config.

Echo Beginning style definitions…

EchoFuncDefinition function

The EchoFuncDefinition is similar to the Echo command but prints the definition for the given function

to stderr. It is useful to find out how fvwm handles quoting and for debugging functions

Exec command

Executes command. You should not use an ampersand ‘&’ at the end of the command. You probably want

to use an additional “exec” at the beginning of command. Without that, the shell that fvwm invokes to

run your command stays until the command exits. In effect, you’ll have twice as many processes

running as you need. Note that some shells are smart enough to avoid this, but it never hurts to

include the “exec” anyway.

The following example binds function key F1 in the root window, with no modifiers, to the exec

function. The program rxvt is started with an assortment of options.

Key F1 R N Exec exec rxvt -fg yellow -bg blue \

-e /bin/tcsh

Note that this function doesn’t wait for command to complete, so things like:

Exec “echo AddToMenu … > /tmp/file”

Read /tmp/file

do not work reliably (see the PipeRead command).

ExecUseShell [shell]

Makes the Exec command use the specified shell, or the value of the $SHELL environment variable if no

shell is specified, instead of the default Bourne shell (/bin/sh).


ExecUseShell /usr/local/bin/tcsh

Function FunctionName

Used to bind a previously defined function to a key or mouse button. The following example binds

mouse button 1 to a function called “Move-or-Raise”, whose definition was provided as an example

earlier in this man page. After performing this binding fvwm executes the “move-or-raise” function

whenever button 1 is pressed in a window’s title-bar.

Mouse 1 T A Function Move-or-Raise

The keyword Function may be omitted if FunctionName does not coincide with an fvwm command.

Warning: Please read the comments on executing complex functions in the section Scripting and Complex


InfoStoreAdd key value

Stores the value at the given key. This is useful to store generic information used in the lifetime

of an fvwm config file. For example storing program preferences for opening video files.

The purpose of this command is to store internal information to fvwm which can be used bu fvwm

functions, or when opening programs of a certain type. Previous to this command the only way to do

this was via SetEnv but this is discouraged because it places such information in the environment,

which pollutes it and makes the information global to other processes started by fvwm which may then

modify them which might not be what’s wanted. Hence the point of InfoStoreAdd is to still allow for

such information to be stored, but kept internal to fvwm.

In this way, one can build up as many key/value pairs as needed. Recalling the value of a given key

happens through fvwm’s usual expansion mechanism. See the Command Expansion section for more details.

For example:

InfoStoreAdd teddybearprog xteddy

# Echo the value of teddybearprog

Echo $[infostore.teddybearprog]

Removing an entry from the InfoStore is done with the InfoStoreRemove command.

InfoStoreRemove key

Removes an entry at the given key from the InfoStore. Example:

InfoStoreRemove teddybearprog


Does nothing. This is used to insert a blank line or separator in a menu. If the menu item

specification is

AddToMenu MyMenu ” ” Nop

then a blank line is inserted. If it looks like

+ “” Nop

then a separator line is inserted. Can also be used as the double-click action for Menu or Popup.

PipeRead command [Quiet]



AddToMenu HomeDirMenu

PipeRead ‘for i in $HOME/*; \

do echo “+ $i Exec xterm -e vi $i”; done’


BusyCursor Read off


PipeRead ‘command 1>&2’

重定向会使所有的command输出进入stderr,而不是被FVWM按序列执行的命令。如果命令可以执行则PipeRead返回1。有关返回码的含义查看Conditional Commands部分。

Read filename [quiet]

使fvwm从名为filename的文件中读取配置命令。 如果使用了关键字Quiet,则在没有找到文件的情况下不会产生任何消息。
如果给定的文件可以被读取,则返回1;否则返回-1(有关返回代码的含义,参阅Conditional Commands部分)。

SetEnv variable value


SetEnv height HEIGHT


Silent command

A number of commands require a window to operate on. If no window was selected when such a function

is invoked the user is asked to select a window. Sometimes this behavior is unwanted, for example if

the function was called by a module and the window that was selected at first does not exist anymore.

You can prevent this by putting Silent in front of the fvwm command. If a function that needs a

window is called with Silent without a window selected, it simply returns without doing anything. If

Silent is used on a user defined function it affects all function and sub function calls until the

original function exits.

Another usage of Silent is with binding commands Key, PointerKey and Mouse, this disables error


Silent also disables the error message for non-existent commands. Note: This command is treated as a

prefix to its command. Expansion of the command line is done as if Silent was not there.


Silent Move 0 0

Silent User_defined_function

# do not complain on keyboards without “Help” key

Silent Key Help R A Popup HelpMenu

UnsetEnv [variable]

Unset an environment variable, similar to shell’s export or unsetenv command. The variable then is

removed from the environment array inherited by processes started directly by fvwm.

Wait window

This command is intended to be used in fvwm functions only. It causes execution of a function to

pause until a new window matching window appears. This can be a window’s name, class, or resource

string. It may contain the wildcards ‘*’ and ‘?’, which are matched in the usual Unix filename

manner. This is particularly useful in the “InitFunction” if you are trying to start windows on

specific desktops:

AddToFunc InitFunction

+ I Exec exec xterm -geometry 80×64+0+0

+ I Wait xterm

+ I GotoDesk 0 2

+ I Exec exec xmh -font fixed -geometry \
+ I Wait xmh

+ I GotoDesk 0 0

The above function starts an xterm on the current desk, waits for it to map itself, then switches to

desk 2 and starts an xmh. After the xmh window appears control moves to desk 0.

Fvwm remains partially functional during a wait, but any input from the modules is queued up and

processed only after the window appears or the command is aborted. For example, windows can not be

focused with FvwmIconMan or FvwmPager during a wait.

You can escape from a Wait pause by pressing Ctrl-Alt-Escape (where Alt is the first modifier). To

redefine this key sequence see the EscapeFunc command.