[Solved] Difference between commands, modules and functions

To start with FVWM, I have needed to understand the difference between commands, modules and functions. It may be obvious, but I am also a newcomer to unix and have little computer knowledge (my field is social psychology). I have been reading the man page, looking and some posts and had help from that guy that never sleeps (T.A. :wink: ). You can find a summary in the FVWM gentoo wiki page, and I am also posting it here in case it helps another newcomer.

Commands, Functions and Modules

To start, FVWM reads the config file (and all files read by config). After reading the whole of the configuration it executes StartFunction (if defined) and then InitFunction (if defined).

Commands refer both to configuration and action commands. Look at the list of fvwm commands. The following command defines a desktop sixe of 3x2 pages.

DesktopSize 3x2

Modules. As the man page states, a module is a separate program which runs as a separate Unix process but transmits commands to FVWM to execute. FVWM comes with a pre-defined number of modules, and you will find here the commands to configure them. For example, the FVWM man page mentions FvwmBacker as the module that changes the background when you change desktops. First, you have a look at the man page of FvwmBacker to know its syntax.

# man FvwmBacker

Now, you can define FvwmBacker. This example defines six different backgrounds for the pages defined by the previous DesktopSize command.

DestroyModuleConfig FvwmBacker:* *FvwmBacker: Command (Desk 0, Page 0 0) Exec xsetbg -fullscreen 1_HAL_9000_eye.jpg *FvwmBacker: Command (Desk 0, Page 1 0) Exec xsetbg -fullscreen 2_Royal_Mail_by_l8.jpg *FvwmBacker: Command (Desk 0, Page 2 0) Exec xsetbg -fullscreen 3_linux-code.jpg *FvwmBacker: Command (Desk 0, Page 0 1) Exec xsetbg -fullscreen 4_the_f33r3x_web.jpg *FvwmBacker: Command (Desk 0, Page 1 1) Exec xsetbg -fullscreen 5_Thalo_Blyue_Cyborg_by_King_Nathan.png *FvwmBacker: Command (Desk 0, Page 2 1) Exec xsetbg -tile 6_LookClosely_by_sanfranguy.jpg Module FvwmBacker
In the next example, the command Style defines the style (where and how) of FvwmButtons module with alias Confi (you can have different FvwmButtons running with different alias). The style defines that the module will appear on page 0,0, without the buttons 1,2 and 4, and it will not show in the window list of active programmes. The definition of the module Confi follows.

[code]Style Confi StartsOnPage 0 0 0,!Button 1,!Button 2,!Button 4,!Borders,WindowListSkip
DestroyModuleConfig Confi: * # Destroy previous module configuration.

We define the module Confi…

*Confi: Rows 3 # that has 3 rows of buttons
*Confi: Columns 2 # and two colums of buttons
*Confi: Geometry 60x90+0+0 # Size 60x90 on the top of the screen
*Confi: Back rgb:ff/ff/99 # yellow
# First button executes konqueror
*Confi: (1x1, Icon konqueror.png, Action(Mouse 1) ‘Exec konqueror --profile filemanagement’)
*Confi: (1x1) # Rest of the buttons still undefined
*Confi: (1x1)
*Confi: (1x1)
*Confi: (1x1)
Module FvwmButtons Confi # Executes module FvwmButtons with alias ‘Confi’[/code]

A function is a collection of commands that performs a specific task. FVWM has its own default functions (like ‘‘StartFunction’’). Typically, where a function defines a set of rules, they’re called a ‘‘complex function’’.

Order of Execution. As it is stated in this and this post, the order of execution of the config file is the following:

Commands (as they are found) StartFunction, InitFunction, RestartFunction Functions and Modules
For example, if you have in your config file:

[code]AddToFunc StartFunction

  • I Test (Init) Exec exec kontact
    Style Kontact StartsOnPage 0 1 0[/code]
    Kontact will start on Page 0,1,0 despite the command Style is posterior to the ‘’‘function’‘’ StartFunction.
    The prefix function and module tells fvwm the type of object. If the prefix is omitted, fvwm will try to match it following this order (fvwm man page):

Thank you.