WindowTitle

Hi!

I have two questions related to fvwmscripts:

  1. Is it possible to set the WindowTitle property from an argument?

    Something like this: WindowTitle (GetScriptArgument $somearg)
    That would be nice…

  2. FvwmScript command can read a fvwmscript from pipe?

    I mean in the way that functions do:

    AddToFunc …

    • I PipeRead ‘Some echoes’

    You can use a script called Script1 to generate a bunch of fvwmscripts, then write another script Script2 to create a fvwm function that calls those scripts:
    DestroyFunc launchScripts
    AddToFunc launchScripts

    • I PipeRead ‘Script2’

    and then call launchScripts. But It’s a little complicated…

I’m intending to reuse fvwmscripts or , if It’s not possible, to generate scripts on the fly.

I’m sorry, my explanation is pretty bad (just like my english:).

Thanks in advance.

You want to read up about SendToModule

      You can use a script called Script1 to generate a bunch of fvwmscripts, then write another script Script2 to create a fvwm function that calls those scripts:
      DestroyFunc launchScripts
      AddToFunc launchScripts
      + I PipeRead 'Script2'

      and then call launchScripts.  But It's a little complicated...

You could do that, but it seems a little… overkill.

– Thomas Adam

But, SentToModule can’t change the WindowTitle property. It seems that is
widget oriented.:roll:

I use a function to place fvwmscripts based in the WindowTitle:

DestroyFunc StartFvwmScriptAndMove
AddToFunc StartFvwmScriptAndMove
+ I FvwmScript $3
+ I Wait $0
+ I All ($0) Move $1 $2

So If I want to reuse a fvwmscript called FvwmStorage I would need something like this:

AddToFunc StartFunction
+ I StartFvwmScriptAndMove FwmStorageHda -0 -0 "FvwmStorage FvwmStorageHda /dev/hda"
+ I StartFvwmScriptAndMove FwmStorageHdb -0 -30p "FvwmStorage FvwmStorageHdb /dev/hdb"

The first argument would be used to reset the WindowTitle.

I agree. Because of this I’m searching a “decent” alternative. :wink:

Thanks a bunch, Thomas!

It’s open source… change it. :slight_smile:

You should be using “Next” in place of “All” above – using All is overkill.

– Thomas Adam

First of all I wanted to assure that I wasn’t committing an error.

It should be a minor change. When I finish my thesis I’m going to take a look at the code.

Ok. Thank you, pal.

It would be great if you could implement §1, it would make quite some people happy I’m sure so don’t forget to send the patch to fvwm-workers once you’re done :slight_smile:

Today I was a bit stressed so I began to play with the code. I got It!
It was pretty simple. Now I’ve a new instruction:

“WindowTitleArg n”

that changes the window title to the nth argument value.

Till October I’m PRETTY occuped with my thesis. After that I’m going to
send my patch to fvwm-workers, as you suggested.

There could be only a problem: As WindowTitleArg is an instruction, when
the window is created It has the WindowTitle name, till the Init section starts… Is that a BIG problem?

The same fvwmscript used with several discs:

Regards!

Hi there, the patch can be downloaded from:

usuarios.lycos.es/staufway/patch … -2.5.18.gz

Now It’s possible to change the window title by means of
a new set of instructions or using the SendToModule command.

The new instructions are:

ChangeWindowTitle {string}: Changes the window title to the string passed as argument.
ChangeWindowTitleFromArg numarg: Changes the window title to the value of the “numarg”
argument of the script.

The new functionality added to SendToModule:

SendToModule fvwmScriptName ChangeWindowTitle newTitle [oldTitle]

The optional argument oldTitle makes sense when you have several instances of
the same script. It permits you to avoid the change of the name of all that instances
by specifying the name of the window associated to the target script (see the examples
below).

With that functionalities you can reuse a fvwmscript, doing things like this:

DestroyFunc StartFvwmScriptAndMove
AddToFunc StartFvwmScriptAndMove
+ I FvwmScript $3
+ I Wait $0
+ I Next ($0) Move $1 $2

AddToFunc StartFunction
+ I StartFvwmScriptAndMove FwmStorageHda -0 -0 "FvwmStorage FvwmStorageHda /dev/hda"
+ I StartFvwmScriptAndMove FwmStorageHdb -0 -30p "FvwmStorage FvwmStorageHdb /dev/hdb"

Where FvwmStorage takes the new name of the window from its first argument and looks
like this:

WindowTitle {FvwmStorage}
...

Init
   ChangeWindowTitleFromArg 1
...

or something like this:

+ I Module FvwmScript /root/fvwm25/FvwmStorageSend "/dev/hda6"
+ I Wait FvwmStorageSend
+ I SendToModule /root/fvwm25/FvwmStorageSend ChangeWindowTitle HDA6
+ I Module FvwmScript /root/fvwm25/FvwmStorageSend "/dev/hda1"
+ I Wait FvwmStorageSend
+ I SendToModule /root/fvwm25/FvwmStorageSend ChangeWindowTitle HDA1 FvwmStorageSend

Without the FvwmStorageSend argument in the last case, the SendToModule command would
have changed to HDA1 the name of the two instances of FvwmStorageSend.

I want to thank Thomas Adam for suggesting me to add the SendToModule stuff and
his help.

To apply the patch:

$ cd fvwm-2.5.18/modules
$ patch -p0 </path/to/patch-fvwmscript-2.5.18

Best Regards!

My patch has been accepted by fvwm-workers so It will not be necessary
to patch the original sources anymore. :smiley: :smiley: :smiley:

Since some people can be using old versions of fvwm, I will not delete the
patch from my site at the moment.