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
.fvwm2rchad 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
Readcommand 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 theFontcommand either,fixedfont is assumed.*FvwmScript: DefaultFore colorโ sets the default foreground color. if it's not set here and not set in the script withForeColor,blackis used.*FvwmScript: DefaultBack colorโ sets the default background color. if it's not set here and not set in the script withBackColor,grey85is used.*FvwmScript: DefaultHilight colorโ sets the default hilight color. if it's not set here and not set in the script withHilightColor,grey100is used.*FvwmScript: DefaultShadow colorโ sets the default shadow color. if it's not set here and not set in the script withShadowColor,grey55is used.*FvwmScript: DefaultColorset colorsetโ tells the module to usecolorsetas the default colorset.*FvwmScript: DefaultCursor cursorโ tells the module to use the X11 cursorcursoras the default for all widgets. cursor names are the ones defined in the include fileX11/cursorfont.h, but you drop theXC_prefix. ๐
โจ ANATOMY OF A SCRIPT โจ
FvwmScript speaks its own particular programming language, and a script is composed of five parts:
- Heading โ the general characteristics of the window plus the default properties for all widgets.
- the second part โ instructions that get executed at the startup of the script.
- the third part โ periodic tasks, which get executed every second.
- the fourth part โ instructions that get executed at exit.
- 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.widthandheightare numerical values.WindowPosition x yโ sets the window position.xandyare 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 theWindowLocaleTitle,LocaleTitle,ChangeLocaleTitleinstructions and theGettextfunction. 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 isFvwmScript, 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 theLocalePathfvwm command (go see the fvwm manual page for that one ๐). heads up though: this instruction should be placed before theWindowLocaleTitleinstruction. order matters bestie, don't skip the line. ๐ญWindowLocaleTitle stringโ sets the window title, but it uses the locale catalog(s) defined withUseGettext. 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 theKillModulefvwm 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 โ theDocommand 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:
- the first part describes the initial properties,
- 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, exceptRectangle,HDipstickandVDipstick, which cannot. also: theNoFocuswidgets get skipped when you circulate around the widgets with the (Shift)+Tab shortcut.Left/Center/Rightโ specifies the text position. these apply only toItemDraw,List,Menu,PopupMenuandPushButton. the default isCenterforItemDrawandPushButton, andLeftfor 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โ ifValueis equal to1, the box is checked else it is not.- The
Sizeproperty 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
30x11is imposed. No shrinking below that, periodt.
HScrollBar
Displays an horizontal scrollbar. Slay.
Valueโ position of the thumb.MaxValueโ upper limit ofValue.MinValueโ lower limit ofValue.- The height property is ignored and a minimum width is imposed. The width should be at least the range plus
37if all values are to be selectable e.g. a min of0and max of10has a range of11and therefore should have a minimum width of48.
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.
Menu
Displays a menu whom lets user to choose a option. (Yes, "whom", we said what we said ๐)
- Items of type
Menuare 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 ofValue.MinValueโ lower limit ofValue.- 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โ ifValueis equal to1, 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
40pixels 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 ofValue.MinValueโ lower limit ofValue.- The width property is ignored and a minimum height is imposed. The height should be at least the range plus
37if all values are to be selectable e.g. a min of0and max of10has a range of11and therefore should have a minimum height of48.
๐ 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โ AsChangeTitlebut use the locale catalog(s) defined withUseGettext.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 widget0sets 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 theDoblock. 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 exceed988characters.Set $var={str1} {str2} etcโ Concatenate all arguments to a string and set the variable$varto 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 formatRRGGBB.(GetBack id)โ hands you back the current RGB background value of widget number id, in the hex formatRRGGBB.(GetHilight id)โ hands you back the current RGB hilight value of widget number id, in the hex formatRRGGBB.(GetShadow id)โ hands you back the current RGB shadow value of widget number id, in the hex formatRRGGBB.(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,GetOutputgives 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 theSendToScriptandReceiveFromScriptfunctions 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 theLaunchScriptfunction. If int equals zero,GetScriptArgumentgives 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 withUseGettext.(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 is0, FvwmScript does not wait for an answer from the external program. In that case the returned value is1if the message can be sent to the external program, and0if that's not the case. If bool is1, then FvwmScript waits for an answer from the external program, and the return value is that answer (a line of no more than32000characters). If the communication fails, the returned value is0. See the sectionA COMMUNICATION PROTOCOLfor 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 theKeyinstruction and theSendStringcommand (see the COMMANDS section). At startup this string is empty, but when aKeybinding is detected (respectively, aSendStringcommand 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 theFvwmStorageSendargument in the last case, theSendToModulecommand would have changed toHDA1the name of both instances ofFvwmStorageSend. ๐ญ 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
- ubuntu stonking: fvwm3 1.1.5+ds-2 ยท GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms