Modules in Bash or AWK

Hi there,

for quite a while now I’m fumbling trying to get a working fvwm module written either as a shell or an awk script, but I never
really managed to get to the point where the module would be able to send commands to fvwm.
With the shell script I always get an error complaining about the sent string being to big.
With awk I even do not come to that point as I have no idea howto write to a file descriptor.
In one of the topics I read about a module written as a shell script but I didn’t find any source code. It seems to be vanished…
The background is that my fvwm runs on a Zaurus and I try to avoid installing perl in order to save precious disk space.
On the other hand I would like to handle key bindings without the Exec command as it costs too much time to open
a shell each time you want to adjust the volume for mplayer.

Maybe one of you fvwm (or shell or awk) experts can help me by giving me some hints?

Thanks a lot in advance.


There was an unfinished attempt by someone to write sh bindings to talk to FVWM.


Maybe you can tell us what it is you’re really trying to do – it could simply be running an external script using FvwmCommand or just PipeRead suffices, rather than shooting yourself.

– Thomas Adam

Hi Thomas,

here comes my attempt in awk:


awk '

    send_text("NOP FINISHED STARTUP");
    send_text("Echo Test");

  function send_text(text) {
    print text
' 1>&$1 <&$2

I would expect a “Test” in .xsession-errors. But nothing happens.

The shell module is nearly the same:

echo "0" >&$1
echo "NOP FINISHED STARTUP" "0" >&$1
echo "0" >&$1
echo "Echo Test" >&$1

Same result. Nothing in .xsession-errors.

The reasons I try to do this is that a Piperead or Exec would start a shell that e.g. would itself start an xmmsctrl command.
Increasing the volume that way wouldn’t be very responsive as the Zaurus is simply too slow for that. So I thought of using
the xmms-pipe plugin with an fvwm-module that translates and passes the commands directly to the plugin. Same idea
with mplayer in slave-mode.
And, of course, I have kind of a sportive interest in just seeing if it is possible. :slight_smile:


Doesn’t running a bash or awk script use the same resources for opening a shell as pipeexec? I tried it anyway
to see if it would work.

You have the module protocol slightly wrong. A message to fvwm is:
4 bytes for the window id
4 bytes for the message length
the message as an ascii string
4 bytes for continue (1 or 0)

With echo, the numbers have to be sent as binary by converting them to octal escape sequences. Also
echo adds a newline by default, which will affect the data.

So this is the bash fvwm module:


echo -ne “\000\000\000\000” >&$1
echo -ne “\024\000\000\000” >&$1
echo -ne “\001\000\000\000” >&$1

echo -ne “\000\000\000\000” >&$1
echo -ne “\011\000\000\000” >&$1
echo -n “echo Test” >&$1
echo -ne “\001\000\000\000” >&$1[/code]

Or just use printf.

– Thomas Adam

I’m a wee bit late to the party, but did anyone pursue this further?
I cannot, for the life of me, get the posted code to work.

I’d like to take bash as a basis for an early prototype module, using it wrapped inside Haskell’s Turtle Library.

The error I get when launching the module from the FVWM Commandline is the following:

 [fvwm][module_receive]: <<ERROR>> Module(0x22d8b80) command is too big (5282239978490842958), limit is 1000

I have a crontab tcsh script which uses FvwmCommand, and another one which is called periodically by an FvwmScript invoked by the .fvwmrc (this pings a few local hosts and sets the colour of a little widget as green or red whether they respond or not). I have also another one called by a single PipeRead from .fvwmrc