[Solved] Difference between commands, modules and functions

Talk about anything related to FVWM, but don't ask support questions here!
User avatar
mimosinnet
Pussycat
Pussycat
Posts: 85
Joined: Thu Jul 12, 2007 3:54 am

[Solved] Difference between commands, modules and functions

Postby mimosinnet » Sat Aug 04, 2007 2:02 am

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.

Code: Select all

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.

Code: Select all

# man FvwmBacker

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

Code: Select all

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: Select all

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'


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:

Code: Select all

Commands (as they are found)
StartFunction, InitFunction, RestartFunction
Functions and Modules

For example, if you have in your config file:

Code: Select all

AddToFunc StartFunction
+ I Test (Init) Exec exec kontact
Style Kontact StartsOnPage 0 1 0

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):
1. Match it to one of its internal commands.
2. Match it to a function name.
3. Match it to a module.
Last edited by thomasadam on Sat Aug 04, 2007 2:28 am, edited 1 time in total.
Reason: Ensure you destroy the module alias properly.

thomasadam
Administrator
Administrator
Posts: 3043
Joined: Mon Nov 08, 2004 1:12 am
Location: England
Contact:

Re: [Solved] Difference between commands, modules and functions

Postby thomasadam » Sat Aug 04, 2007 2:13 am

Thank you.


Return to “General FVWM discussion”

Who is online

Users browsing this forum: No registered users and 1 guest