FvwmEvent - Man Page

the fvwm event module

Description

FvwmEvent is a module that triggers actions on fvwm events. It can be used to hook any fvwm function or program to any window manager event. FvwmEvent can trigger actions when windows are added, deleted, iconified, shaded, or when fvwm changes which virtual page or desk is being shown, or when RandR monitors are changed, enabled, disabled, or gain focus. Be creative, you’ll find a use for it.

Invocation

FvwmEvent is spawned by fvwm, so no command line invocation will work. FvwmEvent can be spawned from within the config file with or without an Alias as follows:

Module FvwmEvent Alias

You can add this to the StartFunction to ensure FvwmEvent is running and listening for events when fvwm starts. Alternatively you can add this to a menu, key binding, etc. You can kill stop a running instance of FvwmEvent with:

KillModule FvwmEvent Alias

Configuration Options

FvwmEvent gets config info from fvwm's module configuration database (see fvwm(1), section MODULE COMMANDS), and looks for certain configuration options:

*FvwmEvent: Cmd command

This determines the fvwm function that is to be called with the event parameters. You might want to do one of the following (details below):

        # execute distinct fvwm functions
        *FvwmEvent: Cmd

        # execute distinct external programs
        *FvwmEvent: Cmd exec

FvwmEvent has support for any other external program. e.g: the rsynth 'say' command:

        *FvwmEvent: Cmd "Exec /rsynth/say"
        *FvwmEvent: destroy_window "window closed"

You can also use fvwm's builtin Echo command as FvwmEvent: Cmd to obtain debug output for fvwm events quietly. I used this setup to debug FvwmAuto:

        *FvwmEvent: Cmd Echo
        *FvwmEvent: focus_change "focus change"
        *FvwmEvent: raise_window "raise window"

You can even call different shell commands for each event just by setting

        *FvwmEvent: Cmd exec
        *FvwmEvent: add_window 'killname "APPL ERROR"'
*FvwmEvent: PassId

Specifies that the event action will have an ID parameter added to the end of the command line. Most events will have the windowID of the window that the event refers to. The new_desk event will have the new desk number. Monitor events will have the RandR monitor name. The windowID is a hexadecimal string preceded by 0x, desk numbers are decimal, and monitor name’s are strings.

*FvwmEvent: window-manager-event action

Binds particular actions to window manager events. The action is appended to the Cmd which is then sent to fvwm for execution.

The following events are valid:

EventDescription
add_windowOccurs when a new window is mapped and visible
config_infoOccurs when a module asks for configuration
configure_windowOccurs when a ConfigureNotify event happens
default_iconOccurs when a window’s DefaultIcon changes
deiconifyOccurs when a window id deiconified
destroy_windowOccurs when a window is destroyed
dewindowshadeOccurs when a window is unshaded
echoOccurs when an Echo command is run
end_config_infoOccurs when there’s no more module config to send
end_windowlistOccurs when the windowlist has finished sending
enter_windowOccurs when a window receives a EnterNotify event
errorDEPRECATED
focus_changeOccurs when a window gains or loses focus
icon_fileDEPRECATED
icon_locationDEPRECATED
icon_nameDEPRECATED
iconifyOccurs when a window is iconified
leave_windowOccurs when a window receives a LeaveNotify event
lower_windowOccurs when a window is lowered
mapOccurs when a window is Mapped
mini_iconOccurs when a window’s mini icon changes
monitor_changedOccurs when a monitor’s resolution changes
monitor_disabledOccurs when a monitor is disabled (via RandR)
monitor_enabledOccurs when a monitor is enabled (via RandR)
monitor_focusOccurs when a monitor gains focus
new_deskOccurs when a new desk is switched to
new_pageOccurs when a new page is switched to
old_add_windowDEPRECATED
old_configure_windowDEPRECATED
property_changeOccurs when a window receives a PropertNotify event
raise_windowOccurs when a window is raised
res_classOccurs when a window’s Class is set
res_nameOccurs when a window’s Resource is set
restackOccurs when windows are restacked
sendconfigOccurs when FvwmEvent asks for its config
shutdownDEPRECATED
startupDEPRECATED
stringOccurs when the SendToModule command is used
unknownDEPRECATED
visible_icon_nameOccurs when a window’s visible icon name changes
visible_nameOccurs when a window’s visible name changes
window_nameOccurs when a window’s name (WM_NAME) is set
windowshadeOccurs when a window is shaded

The window related event handlers are executed within a window context. Previously PassId was used for this purpose, but now using PassId is not needed.

The monitor_* events do not operate in a window context (as there isn’t one), but react to when a monitor is plugged in (enabled), unplugged (disabled), focused (focus) or changed (resized/rotated, etc., which will only be true if the monitor is already active).

The echo event is generated whenever Fvwm receives an Echo command.

Note: The enter_window event is generated when the pointer enters a window. With the -passid option, that window’s id is passed to fvwm. An enter_window event is generated too when the pointer leaves a window and moves into the root window. In this case, the id passed is 0.

Note: When the shutdown event arrives, FvwmEvent may be killed before it can trigger the associated action.

*FvwmEvent: Delay 5

Specifies that an event-action will only be executed if it occurs at least 5 seconds after the previous event. Events that occur during the delay period are ignored. The default delay is 0 which disables the Event.

*FvwmEvent: StartDelay delay

Specifies that an event-action will only be executed if it occurs at least delay seconds after the startup event. Events that occur during the delay period are ignored. This option is useful when fvwm starts and restarts using an audio player. The default delay is 0.

History

This module has evolved of FvwmAudio, which in term is heavily based on a similar Fvwm module called FvwmSound by Mark Boyns. FvwmAudio simply took Mark’s original program and extended it to make it generic enough to work with any audio player. Due to different requests to do specific things on specific events, FvwmEvent took this one step further and now calls any fvwm function. If fvwm's Exec function is used, any external program can be called with any parameter.

Authors

Info

2025-02-10 Fvwm Modules