Get the current page number via FvwmMFL

I thought that the built-in Echo command writes its params back to a socket connection, but this yields nothing useful:

$ echo 'Echo $[page.nx] $[page.ny]' | nc -U /tmp/fvwm_mfl.sock
{ "connection_profile" : { "version" : "1.0.1", "version_info" : "released" } }

(I can see the result of the Echo command in ~/.fvwm/fvwm3-output.log,

What it the preferred way to read chunks of the current fvwm3 configurations from shell scripts?

I’m using the latest fvwm3 master branch from github.

Hi @alex2

There’s no way at the moment to do this. So I’ve just added this functionality to FvwmMFL and FvwmEvent.

Please take a look at the ta/echo-broadcast branch in git. From there, you can do things like:

echo "set echo\nEcho \$[page.nx] \$[page.ny]" | nc -U $FVWMMFL_SOCKET

Which will return JSON in the form:

{ "echo" : { "message" : "0 0" } }

Let me know how you get on with it. If it’s working without side-effects, I’ll merge it later on.


Wow, thank you! ta/echo-broadcast branch works!

The only minor issue I found was the provided example: bash doesn’t expand backslash escape sequences in its echo command by default, hence at first I was only getting the same json as before & a new error in the fvwm log:

__execute_function: No such command 'set'

but then it dawned upon me that I wasn’t sending a properly formatted string. The example should’ve been akin to:

printf 'set echo\n%s' 'Echo $[page.nx] $[page.ny]' | nc -U $FVWMMFL_SOCKET

Hi @alex2

Thanks for testing – I’ve merged this to master now so you can continue to use that branch.


1 Like