FVWMSCRIPT(1)

๐Ÿ’– FVWMSCRIPT(1) ๐Ÿ’– โ€” or, the manual page where we build cute little GUIs

okay bestie, sit down, grab a boba ๐Ÿง‹, because this is the FVWMSCRIPT(1) page and it's genuinely one of the most fun corners of the entire fvwm universe. lowkey iconic.

โœจ NAME โœจ

FvwmScript โ€” a module for building graphic user interfaces. literally the thing that lets you build actual GUI stuff inside fvwm. it's giving arts and crafts but make it X11. ๐Ÿ’…

โœจ SYNOPSIS โœจ

FvwmScript must be spawned by Fvwm. It will not work from the command
line.

no cap. this one's parents are fvwm and fvwm only โ€” try running it from a plain shell and it will simply Not. ๐Ÿ™ˆ

โœจ DESCRIPTION โœจ

So here's the tea, bestie: FvwmScript is a module that lets you build a lot of graphical applications โ€” think desktop accessories, button panels with pop-up menus, modal dialogs, all of it. the range is unmatched fr fr.

When it starts up, FvwmScript reads the file you handed it on the command line. that file is the script. and heads up: this script is not included in fvwm's own configuration file, it lives in its own little world. ๐Ÿฆ‹

An FvwmScript script is fully controllable with just the keyboard โ€” that's right, no mouse required:

  • (Shift)+Tab circulates around the widgets
  • Return simulates a mouse click
  • the arrows move the cursor or change the values of the widget
  • Escape "cancels" for Menu and PopupMenu

keyboard accessibility queen. periodt. ๐Ÿ‘‘


โœจ INVOCATION โœจ

You bring FvwmScript to life by dropping this line into your .fvwm2rc:

Module FvwmScript name_of_script

now let's talk about how FvwmScript finds name_of_script, because it has options:

  • if the file starts with a slash /, then it's a fully qualified path and FvwmScript just reads it, no questions asked. slay. โœจ
  • if it does not start with a slash, FvwmScript goes looking in a few different places. first up: if your .fvwm2rc had the command line
*FvwmScript: Path path_of_the_script_directory

then FvwmScript will try that directory. ๐ŸŒธ

  • if that doesn't work, FvwmScript tries the system configuration directory and the user configuration directory, exactly as described under the Read command in the fvwm man page. (go read that one too, iykyk.)

You can put the command to start FvwmScript on a line all by itself if you want it spawned during fvwm's initialization, or you can bind it to a menu, a mouse button or a keystroke so you can summon it later like the little icon it is. ๐Ÿ’–

โœจ CONFIGURATION OPTIONS โœจ

These commands go in the config file (peep fvwm(1), section MODULE COMMANDS for the deets). careful though: they're only used when the matching script commands are not used inside the script itself. so the script always wins, got it bestie?

  • *FvwmScript: DefaultFont font โ€” sets the default font. if you don't set it here, and you don't set it in the script with the Font command either, fixed font is assumed.
  • *FvwmScript: DefaultFore color โ€” sets the default foreground color. if it's not set here and not set in the script with ForeColor, black is used.
  • *FvwmScript: DefaultBack color โ€” sets the default background color. if it's not set here and not set in the script with BackColor, grey85 is used.
  • *FvwmScript: DefaultHilight color โ€” sets the default hilight color. if it's not set here and not set in the script with HilightColor, grey100 is used.
  • *FvwmScript: DefaultShadow color โ€” sets the default shadow color. if it's not set here and not set in the script with ShadowColor, grey55 is used.
  • *FvwmScript: DefaultColorset colorset โ€” tells the module to use colorset as the default colorset.
  • *FvwmScript: DefaultCursor cursor โ€” tells the module to use the X11 cursor cursor as the default for all widgets. cursor names are the ones defined in the include file X11/cursorfont.h, but you drop the XC_ prefix. ๐ŸŽ€

โœจ ANATOMY OF A SCRIPT โœจ

FvwmScript speaks its own particular programming language, and a script is composed of five parts:

  1. Heading โ€” the general characteristics of the window plus the default properties for all widgets.
  2. the second part โ€” instructions that get executed at the startup of the script.
  3. the third part โ€” periodic tasks, which get executed every second.
  4. the fourth part โ€” instructions that get executed at exit.
  5. the last part โ€” the description of the widgets.

and a widget? a widget consists of eleven types of items:

  • text labels
  • single-line text inputs
  • radio buttons
  • checkbox
  • push buttons
  • horizontal and vertical scrollbars
  • rectangles
  • pop up menus
  • swallowexecs
  • mini scrollbars

eleven. count them. aesthetic variety is the moment. ๐ŸŒˆ

โœจ HEADING OF A SCRIPT โœจ

the syntax is as follows:

  • WindowTitle string โ€” sets the window title.
  • WindowSize width height โ€” sets the window size. width and height are numerical values.
  • WindowPosition x y โ€” sets the window position. x and y are numerical values.
  • ForeColor {color} โ€” sets the default foreground color for all widgets.
  • BackColor {color} โ€” sets the default background color for all widgets.
  • HilightColor {color} โ€” sets the default hilight color for all widgets.
  • ShadowColor {color} โ€” sets the default shadow color for all widgets.
  • Colorset {n} โ€” sets the default colorset for all widgets.
  • Font {font} โ€” sets the default font for all widgets.
  • UseGettext [locale_path] โ€” enables the gettext mechanism, which is what powers the WindowLocaleTitle, LocaleTitle, ChangeLocaleTitle instructions and the Gettext function. if you give no argument, the default FvwmScript locale catalog is used. that catalog lives under the locale fvwm installation directory, and its text domain is FvwmScript, so like: install_prefix/share/locale/*/LC_MESSAGES/FvwmScript.mo. you can reset this catalog or add more catalogs in exactly the same way as with the LocalePath fvwm command (go see the fvwm manual page for that one ๐Ÿ’œ). heads up though: this instruction should be placed before the WindowLocaleTitle instruction. order matters bestie, don't skip the line. ๐Ÿ˜ญ
  • WindowLocaleTitle string โ€” sets the window title, but it uses the locale catalog(s) defined with UseGettext. fancy multilingual queen. ๐ŸŒธ

โœจ INITIALISATION โœจ

this part holds the instructions that get executed at startup. for example:

Init
Begin
  Do "Exec cat tada.voc > /dev/dsp" WarpPointer 1
  Set $ToDo=Restart End

these instructions are used to play a sound, move the pointer to widget 1, and initialize $ToDo to "Restart" at every startup. multitasking icon. ๐ŸŽ€

โœจ PERIODIC TASKS โœจ

this part of the script contains instructions that run every second. for example:

PeriodicTasks
Begin
  If (RemainderOfDiv (GetTime) 10)==0 Then
    Do {Exec xcalc}
  End

this example shows how to launch xcalc every 10 seconds. math girlies rise. ๐Ÿงฎโœจ

โœจ THE QUIT FUNCTION โœจ

this part of the script contains instructions that get executed when the script exits โ€” that means after the Quit instruction, or if you close the window with the Close, Delete or Destroy fvwm command. for example:

QuitFunc
  Begin
    Do {Echo bye, bye}
  End

cute, she says goodbye. ๐Ÿ˜ญ๐Ÿ’–

but listen: be aware that if you used the KillModule fvwm command to close the script, some instructions or functions that rely on the existence of a communication link between the script and fvwm will not be executed โ€” the Do command is one example. if you want to smoothly kill a script with an fvwm command, see the COMMANDS section. noted? noted. ๐Ÿ’€

โœจ MAIN OF A SCRIPT โœจ

the second part of the script holds the description for every widget in the script. each widget description has two parts:

  1. the first part describes the initial properties,
  2. the second part contains instructions that run when the widget receives messages.

all widgets can send and receive messages, and every message is identified by a number. the UserAction message gets sent to a widget when the user operates that widget. ๐Ÿ‘‘

the syntax for the first part is:

Widget         id   # A number between 1 and 999 inclusive
Property
 Type          string
 Size width    height
 Position      x y
 Title         { string }
 Value         int
 MaxValue      int
 MinValue      int
 Font          string
 ForeColor     { color }
 BackColor     { color }
 HilightColor  { color }
 ShadowColor   { color }
 Colorset int
 Flags         flagsOpt

so about that flagsOpt option to Flags โ€” it's a space separated list containing one or more of these keywords:

  • Hidden โ€” used to specify if the widget is hidden at startup.
  • NoReliefString โ€” specifies if strings are drawn with relief or not.
  • NoFocus โ€” specifies if the widget can get the keyboard focus or not. by default all widgets take focus, except Rectangle, HDipstick and VDipstick, which cannot. also: the NoFocus widgets get skipped when you circulate around the widgets with the (Shift)+Tab shortcut.
  • Left / Center / Right โ€” specifies the text position. these apply only to ItemDraw, List, Menu, PopupMenu and PushButton. the default is Center for ItemDraw and PushButton, and Left for the other widgets.

also, LocaleTitle can be used in place of Title when you want to use the locale catalog(s) defined with UseGettext. ๐ŸŒ

and the position of every widget must be specified. no magic, no defaults, just vibes and coordinates. ๐Ÿ’…

the syntax for the second part is:

Main
Case message of
  SingleClic:
  Begin
   # list of instructions which will be
   # executed when widget receives
   # message "SingleClic". This message is
   # generated by the user.
  End
  1 :
   Begin
    # list of instructions which will be
    # executed when widget receives
    # message 1
   End
End

and that's part one, bestie โ€” more is coming, don't go anywhere. ๐ŸŒธ

โœจ LIST OF WIDGETS โœจ

Okay bestie, there are fifteen types of widgets. Fifteen! That's a whole squad. Let's meet them ๐Ÿ’–

CheckBox

Displays a check box with a string. So cute.

  • Title โ€” title of the check box.
  • Value โ€” if Value is equal to 1, the box is checked else it is not.
  • The Size property is ignored. Bye size, you don't matter here ๐Ÿ’…

HDipstick

Displays a horizontal dipstick. This widget can be used to display disk usage. Think disk usage vibes ๐Ÿ“Š

  • Value โ€” specify the current value of the dipstick.
  • MinValue โ€” specify the minimum value of the dipstick.
  • MaxValue โ€” specify the maximum value of the dipstick.
  • A minimum size of 30x11 is imposed. No shrinking below that, periodt.

HScrollBar

Displays an horizontal scrollbar. Slay.

  • Value โ€” position of the thumb.
  • MaxValue โ€” upper limit of Value.
  • MinValue โ€” lower limit of Value.
  • The height property is ignored and a minimum width is imposed. The width should be at least the range plus 37 if all values are to be selectable e.g. a min of 0 and max of 10 has a range of 11 and therefore should have a minimum width of 48.

ItemDraw

Displays an icon and/or a string. Iconic โœจ

  • Title โ€” string to display.
  • Icon โ€” icon to display.
  • MaxValue โ€” x coordinate of the cursor.
  • MinValue โ€” y coordinate of the cursor.
  • The size is made large enough to contain the title and/or the icon.

List

Displays a list. Letting the user choose between various options, main character energy.

  • Value โ€” specify which option is selected.
  • MinValue โ€” First visible option.
  • Title โ€” title contains options displayed in the list. The syntax is the following: {Option 1|Option 2|...|Option N}. All menus are displayed at the top of window.
  • A minimum height of three items is imposed and the width is made to be at least 108.

Displays a menu whom lets user to choose a option. (Yes, "whom", we said what we said ๐Ÿ˜Œ)

  • Items of type Menu are layed out from left to right along the top of the window. The size and position properties are ignored.
  • Value โ€” specify which option is selected.
  • Title โ€” title contains options displayed in the menu. The syntax is the following: {Option 1|Option 2|...|Option N}.

MiniScroll

Displays a very small vertical scrollbar. Tiny but mighty ๐Ÿงš

  • Value โ€” position of the thumb.
  • MaxValue โ€” upper limit of Value.
  • MinValue โ€” lower limit of Value.
  • The size is set to 19x34.

PopupMenu

Displays a pop up menu. Popping off ๐Ÿ’…

  • Value โ€” specify what option is selected.
  • Title โ€” the title has the following syntax: {Option 1|Option 2|...|Option N}. "Option 1|Option 2|...|Option N" is the pop up menu which is displayed when pressing mouse button.
  • The size property is ignored.

PushButton

Displays push button with an icon and/or a string. Push it, push it ๐ŸŽ€

  • Title โ€” this string has the following syntax {Title of the button|Option 1|Option 2|Option3|...|Option N}. "Option 1|Option 2|...|Option N" is the pop up menu which is displayed when pressing the right button.
  • Icon โ€” icon to display.
  • The button is made large enough to fit the icon and or label.

RadioButton

Displays radio button with a string. Choose one, bestie.

  • Title โ€” title of the radio button.
  • Value โ€” if Value is equal to 1, the box is checked else it is not.
  • The size property is ignored

Rectangle

Displays a rectangle. This type of widget can be used to decorate window. Decorate! ๐ŸŽจ

SwallowExec

This type of widget causes FvwmScript to spawn an process, and capture the first window whose name or resource is equal to Title, and display it in the script window. Spawning and capturing, okay? ๐Ÿซถ

  • Title โ€” specify the window name which be captured and displayed in the script window.
  • SwallowExec โ€” specify the command line to execute to spawn the process. Modules can also be swallowed.
  • Value โ€” specify the looking of the border. Possible value: -1, 0, 1.
  • The size is made to be at least 30x30.

TextField

Displays a text input field. The text input field can be used to edit a single-line string. Type type type โœ๏ธ

  • Title โ€” content of text field.
  • Value โ€” position of the insert point.
  • MinValue โ€” position of the end of the selection.
  • MaxValue โ€” first visible character of the title
  • The height property is ignored, the width is made to be at least 40 pixels wider than the initial contents.

VDipstick

Displays a vertical dipstick. Vertical vibes ๐Ÿ“ˆ

  • Value โ€” specify the current value of the dipstick.
  • MinValue โ€” specify the minimum value of the dipstick.
  • MaxValue โ€” specify the maximum value of the dipstick.
  • The size is made to be at least 11x30.

VScrollBar

Displays a vertical scrollbar. Scroll scroll scroll.

  • Value โ€” position of the thumb.
  • MaxValue โ€” upper limit of Value.
  • MinValue โ€” lower limit of Value.
  • The width property is ignored and a minimum height is imposed. The height should be at least the range plus 37 if all values are to be selectable e.g. a min of 0 and max of 10 has a range of 11 and therefore should have a minimum height of 48.

๐Ÿ“œ INSTRUCTIONS ๐Ÿ“œ

Here is the description of all instructions. Let's get into it, besties.

  • HideWidget id โ€” hide the widget numbered id.
  • ShowWidget id โ€” show the widget numbered id.
  • ChangeValue id1 id2 โ€” Set the value of the widget numbered id1 to id2.
  • ChangeMaxValue id1 id2 โ€” Set the maximum value of the widget numbered id1 to id2.
  • ChangeMinValue id1 id2 โ€” Set the minimum value of the widget numbered id1 to id2.
  • ChangeTitle id1 id2 โ€” Set the title of the widget numbered id1 to id2.
  • ChangeWindowTitle string โ€” Set the title of the window to string.
  • ChangeWindowTitleFromArg numarg โ€” Set the title of the window to the value of the numarg-th script argument.
  • ChangeLocaleTitle id1 id2 โ€” As ChangeTitle but use the locale catalog(s) defined with UseGettext.
  • ChangeIcon id1 id2 โ€” Set the icon of the widget numbered id1 to id2.
  • ChangeForeColor id1 {color} โ€” Set the foreground color of the widget numbered id1 to {color}.
  • ChangeBackColor id1 {color} โ€” Set the background color of the widget numbered id1 to {color}.
  • ChangeColorSet id1 id2 โ€” Set the colorset of the widget numbered id1 to id2. Specifying widget 0 sets the main window colorset.
  • ChangePosition id1 x y โ€” Move the widget numbered id1 to position (x,y).
  • ChangeSize id1 width height โ€” Set the size of the widget numbered id1 to (width,height).
  • ChangeFont id1 newfont โ€” Set the font of the widget numbered id1 to newfont.
  • WarpPointer id โ€” Warp the mouse pointer into the widget numbered id.
  • WriteToFile filename {str1} {str2} etc โ€” Write to the file filename the string which is the concatenation of all arguments str1, str2, etc.
  • Do {command args} โ€” Execute the fvwm command inside the Do block. Any fvwm command as described in the fvwm man page can be used. Commands are sent from this module to the fvwm main program for processing. The length of the command and arguments can not exceed 988 characters.
  • Set $var={str1} {str2} etc โ€” Concatenate all arguments to a string and set the variable $var to this string.
  • Quit โ€” quit the program.
  • SendSignal id1 id2 โ€” Send a message numbered id2 to widget id1.
  • SendToScript id_script {str11} {str2} etc โ€” Send a message to the script identified by id_script. The message is the concatenation of str1, str2...
  • Key Keyname Modifier id sig str1 str2 etc โ€” Binds a keyboard key to the instruction
SendSignal id sig

and sets the "last string" to the concatenation of str1, str2... (see the LastString function). The Keyname and Modifiers fields are defined as in the fvwm Key command.


๐Ÿง  ARGUMENTS ๐Ÿง 

Most of commands use arguments. There are two kinds of arguments: numbers and strings. A numerical argument is a value which is between -32000 and +32000. A string is always surrounded with braces. Variables always begin with the character "$" and can contain both numbers and strings.

โœจ FUNCTIONS โœจ

okay so bestie, functions are the whole โœจsparkleโœจ of this language, and the thing to know is: every function takes arguments, and a function can hand you back both a string and a number, like it's just casually showing off. ๐Ÿ’…

The syntax is literally this and nothing else:

(function argument1 argument2 etc)

Here's the complete list of arguments โ€” no skips, no cuts, we are going through all of them because I will not let you miss one. ๐Ÿซถ

  • (GetTitle id) โ€” hands you back the title of widget number id.
  • (GetValue id) โ€” hands you back the current value of widget number id.
  • (GetMinValue id) โ€” hands you back the current Min value of widget number id.
  • (GetMaxValue id) โ€” hands you back the current Max value of widget number id.
  • (GetFore id) โ€” hands you back the current RGB foreground value of widget number id, in the hex format RRGGBB.
  • (GetBack id) โ€” hands you back the current RGB background value of widget number id, in the hex format RRGGBB.
  • (GetHilight id) โ€” hands you back the current RGB hilight value of widget number id, in the hex format RRGGBB.
  • (GetShadow id) โ€” hands you back the current RGB shadow value of widget number id, in the hex format RRGGBB.
  • (GetOutput {str} int1 int2) โ€” runs the command str, grabs the standard output, and gives you back the word sitting on line int1 at position int2. If int2 is -1, GetOutput gives you back the whole entire line instead. ๐ŸŒˆ
  • (NumToHex int) โ€” gives you back the hexadecimal value of int.
  • (HexToNum {str}) โ€” gives you back the decimal value of str. heads up: str must be a hexadecimal value. no exceptions, no takesies backsies. ๐Ÿ’€
  • (Add int1 int2) โ€” gives you back the result of (int1+int2).
  • (Mult int1 int2) โ€” gives you back the result of (int1*int2).
  • (Div int1 int2) โ€” gives you back the result of (int1/int2).
  • (StrCopy {str} int1 int2) โ€” gives you back the string that lives between position int1 and int2. Like, for example, (StrCopy {Hello} 1 2) gives you back {He}. so cute. ๐ŸŽ€
  • (LaunchScript {str}) โ€” this one launches the script named str and gives you back an identification number. you need that number if you wanna use the SendToScript and ReceiveFromScript functions later, so don't lose it. The string str holds the script name plus some arguments.
  • (GetScriptArgument {int}) โ€” gives you back the argument script that was used in the LaunchScript function. If int equals zero, GetScriptArgument gives you back the name of the script.
  • (GetScriptFather) โ€” gives you back the identification number of the script father. ๐Ÿ‘‘ (the parent script, the one that made it)
  • (ReceivFromScript {int}) โ€” gives you back the message sent by the script numbered int.
  • (RemainderOfDiv {int1 int2}) โ€” gives you back the remainder of the division (int1/int2).
  • (GetTime) โ€” gives you back the time in seconds. โฐ
  • (GetPid) โ€” gives you back the process id of the script.
  • (Gettext {str}) โ€” gives you back the translation of str, using the locale catalog(s) you defined with UseGettext.
  • (SendMsgAndGet {comId} {cmd} bool) โ€” sends the command cmd with identifier comId to an external program that's ready to talk to the script using a protocol specific to FvwmScript. Here's the tea: if bool is 0, FvwmScript does not wait for an answer from the external program. In that case the returned value is 1 if the message can be sent to the external program, and 0 if that's not the case. If bool is 1, then FvwmScript waits for an answer from the external program, and the return value is that answer (a line of no more than 32000 characters). If the communication fails, the returned value is 0. See the section A COMMUNICATION PROTOCOL for a description of the communication protocol used. ๐Ÿ“ก
  • (Parse {str} int) โ€” where str must be a string of the form:
X1S1X2S2X3S3...SnXn

where the Xn are numbers containing four decimal digits, and where the Sn are strings of length exactly Xn. The returned value is the string Sint. If int is out of range (e.g., >n), the returned value is the empty string. If str is not of the specified form, the return value is unpredictable (but empty in the average, lmao, no cap ๐Ÿ’€). This function is useful for handling strings returned by the SendMsgAndGet function.

  • (LastString) โ€” gives you back the "current working string" for the Key instruction and the SendString command (see the COMMANDS section). At startup this string is empty, but when a Key binding is detected (respectively, a SendString command is received), then this string gets set to the string associated to the instruction (respectively, to the command). ๐Ÿฆ‹

๐Ÿ” CONDITIONAL LOOPS ๐Ÿ”

There are three kinds of conditional loops, bestie. Buckle in.

The instruction If-Then-Else has this syntax:

If $ToDo=={Open xcalc} Then
  Do {Exec xcalc &}                 # List of instructions
  Else
  Begin
    Do {Exec killall xcalc &}         # List of instructions
    Do {Exec echo xcalc killed >/dev/console}
  End

The second part, Else-Begin-End, is optional โ€” you don't have to use it if you don't wanna. And if the loop contains only one instruction, you can straight up omit Begin and End. slay, keep it short. โœจ

The instruction While-Do has this syntax:

While $i<5 Do
Begin
  Set $i=(Add i 1)                 # List of instructions
End

Two strings can be compared with ==, and two numbers can be compared with <, <=, ==, >=, >. ๐Ÿงš

The loop For-Do-Begin-End has this syntax:

For $i=1 To 20 Do
Begin
  Do {Exec xcalc &}                 # List of instructions
End

๐Ÿ’ฌ COMMANDS ๐Ÿ’ฌ

The following fvwm command can be executed at any time:

SendToModule ScriptName SendString id sig str

It sends to any module with an alias or name that matches ScriptName the string:

SendString id sig str

When an FvwmScript receives a message like that, it sends to the Widget id the signal numbered sig, and the string str can be obtained with the LastString function. ๐Ÿ’Œ

Let me give you an example, since examples are everything. Say you have a script MyScript with this widget:

Widget 50
Property
  Type PushButton
  Title {Quit}
  ...
Main
Case message of
  SingleClic:
     Begin
       Quit
     End

     1 :
     Begin
       Set $str = (LastString)
       If $str == {Quit} Then
         Quit
       Else
         ChangeTitle 33 $str
     End
End

Then the command:

SendToModule MyScript SendString 50 1 str

forces MyScript to exit if str is equal to "Quit", and if it's not, it changes the title of Widget 33 to str. iconic behaviour honestly. ๐Ÿ‘‘

This command can be used to change the window title:

SendToModule ScriptName ChangeWindowTitle newTitle [oldTitle]

It causes any module with an alias or name that matches ScriptName to change its associated window title to newTitle. The optional argument oldTitle makes sense when there are several instances of the same script. It lets you avoid changing the name of all those instances by specifying the name of the window associated to the target script (see the example below). ๐ŸŽ€

+ I Module FvwmScript FvwmStorageSend "/dev/hda6"
+ I Wait FvwmStorageSend
+ I SendToModule FvwmStorageSend ChangeWindowTitle HDA6
+ I Module FvwmScript FvwmStorageSend "/dev/hda1"
+ I Wait FvwmStorageSend
+ I SendToModule FvwmStorageSend ChangeWindowTitle HDA1 FvwmStorageSend
Without the FvwmStorageSend argument in the last case, the SendToModule command would have changed to HDA1 the name of both instances of FvwmStorageSend. ๐Ÿ˜ญ so yeah, that argument is doing real work.

๐ŸŽ€ EXAMPLES ๐ŸŽ€

You will find examples of scripts in the fvwm configuration directory. ๐Ÿฆ‹

FvwmScript-BellSetup, FvwmScript-KeyboardSetup, FvwmScript-PointerSetup and FvwmScript-ScreenSetup are a set of scripts that modify X settings. These scripts save preferences into a file named ~/.xinit-fvwmrc (if you want to use another file name, give it as the first argument of the script). If you want to load these preferences at every startup, you have to include the line .xinit-fvwmrc in your .xinitrc (or .xsession) file before starting fvwm.

FvwmScript-BaseConfig modifies fvwm focus and paging mouse policy, window placement, opacity and other features of the move and resize commands, snap attraction and shading animation. This script saves preferences into a file named .FvwmBaseConfig in the user's data directory (i.e., $HOME/.fvwm or $FVWM_USERDIR if set). If you want to load these preferences at every startup you must add the line Read .FvwmBaseConfig in your fvwm configuration file. If you want to use another file name, give it as the first argument of the script. When you click on Ok or Apply, an fvwm function that you may define named BaseConfigOkFunc or BaseConfigApplyFunc is called. This allows for reloading specific application styles that the script has destroyed (e.g., AddToFunc BaseConfigOkFunc I Read MyAppStyle). ๐Ÿ’…

FvwmScript-Buttons is a buttons panel which can replace FvwmButtons (this script supports popup menus and requires xload, xclock, FvwmPager, TkDesk). FvwmScript-Colorset allows you to edit your colorset. FvwmScript-Date allows you to set date and time. FvwmScript-FileBrowser is a file browser used by the other scripts. FvwmScript-Find is an elementary front-end to find. FvwmScript-Quit allows one to quit fvwm, restart fvwm or some other window manager, or shut down and reboot the computer. FvwmScript-ScreenDump is a screen dumper. FvwmScript-WidgetDemo is a pure example script. See the next section for FvwmScript-ComExample. ๐ŸŒˆ

๐Ÿ“ก A COMMUNICATION PROTOCOL ๐Ÿ’ฌ

Okay bestie, real talk: FvwmScript is a weak (but simple ๐Ÿ’…) programming language. So if you need to deal with a LOT of data and/or you need to run complex algorithms, you should use an external program (in perl, for example) and "send" the info you want over to your FvwmScript script. The way that first approach works is the GetOutput function. It's simple, sure, but you have to rerun your external program every single time you need info from it (and that can cause performance problems ๐Ÿ˜ญ). The second approach is the SendMsgAndGet function, which extends FvwmScript by letting you use ANY programming language that can deal with named pipes (fifos). We're describing that solution in this section. (There's a third approach โ€” using fvwm-themes-com from the fvwm-themes package โ€” but honestly the SendMsgAndGet method is basically fvwm-themes-com implemented inside FvwmScript and it gives better performance ๐Ÿ’ซ.)

Basically, you start an "external" program (let's call it the program) from your FvwmScript script (let's call it the script). This program runs in the background, and you use the SendMsgAndGet function in your script to ask it questions or give it instructions. The program must STRICTLY respect a certain communication protocol, no vibes-based guessing here โš ๏ธ.

First of all, there's an identifier comId for the communication โ€” it should contain the process id of the script for a good implementation of the protocol (use the GetPid function and pass the comId via an option to the program). The protocol uses two fifos, in the fvwm user directory, named: .tmp-com-in-comId and .tmp-com-out-comId.

The program should create and listen on the .tmp-com-in-comId fifo. Then, when FvwmScript executes a function of the form:

Set $answer = (SendMsgAndGet {comId} {cmd} bool)

...FvwmScript writes the cmd on this fifo. That way the program can read the cmd and execute the appropriate action (it should remove the in fifo to support multi-communications). If bool is 0, FvwmScript does NOT wait for an answer from the program and returns 1 if the previous actions succeed and 0 if they failed (and then the program should "go back" to the in fifo). If bool is 1, then FvwmScript waits (20 sec โณ) for an answer from the program and in turn returns the answer to the script (note that bool is not passed to the program, because the program must know which commands need an answer). To answer, the program creates the .tmp-com-out-comId fifo and writes the answer on it. The program should wait until FvwmScript reads the answer, and then it should remove the out fifo and go back to the in fifo. The answer should consist of one line of no more than 32000 characters (take a look at the Parse function to handle multiple lines as one line ๐Ÿ‘€).

A simple way to understand this protocol โ€” and to write scripts and programs that use it โ€” is to take a look at the (not useful ๐Ÿ™ˆ) example FvwmScript-ComExample and fvwm-script-ComExample.pl (that can be found in the fvwm data directory). And bonus: this implementation of the protocol solves questions like: What to do if the script exits for a bad reason? What to do if the program exits for a bad reason? ...etc. So your chaotic little processes are handled, periodt โœจ.


๐Ÿ’€ BUGS ๐Ÿ’€

FvwmScript crashes if widgets are accessed that have not been defined.

Not me finding out the hard way ๐Ÿ˜ญ Bestie, define your widgets FIRST. Slay responsibly.

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Frederic Cordier (cordie97@cui.unige.ch or f-cord96@univ-lyon1.fr).


๐Ÿซถ CONTRIBUTOR ๐Ÿซถ

Eddy J. Gurney (eddy@gizmo.aa.ans.net).


And that's the whole page, bestie!! ๐ŸŽ€ The manpage itself is dated 2026-07-31 and it's the FVWMSCRIPT(1) page from the fvwm source โ€” so if you're reading this, go define your widgets, respect the protocol, and stay iconic ๐Ÿ’…๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from