howto call restart with parameters

I have not been trixing with my config for a long while now.- but as i feel a need to make the system work better i finally took myself time to create a new config file, but i have lost some of the few things i learned the last time i made my config-and its not easy to me to read the fine manual all over again (i have a dissorder), so please escuse for theese simple questions.

Can someone tell me how to call Restart in a proper way.
Here it’s newer gets executed.

my .config

IgnoreModifiers L25

DestroyMenu ChoiceMenu
AddToMenu ChoiceMenu "ChoiceMenu" Title
+ "Config_1"    SetEnv Cfg /home/peter/.fvwm/Config_1  RestartFunction
+ "Config_2"    SetEnv Cfg /home/peter/.fvwm/Config_2  RestartFunction

DestroyFunc RestartFunction
AddToFunc RestartFunction
Read $[Cfg]

AddToMenu  MenuFvwmRoot "ChoiceMenu"
+ "ChoiceMenu" Popup ChoiceMenu

i also tried this

IgnoreModifiers L25

DestroyMenu ChoiceMenu
AddToMenu ChoiceMenu "ChoiceMenu" Title
+ "Config_1" Config1_Function
+ "Config_2" Config2_Function

DestroyFunc Config2_Function
AddToFunc Config2_Function
SetEnv Cfg /home/peter/.fvwm/Config_2
+ I Restart

DestroyFunc Config1_Function
AddToFunc Config1_Function
SetEnv Cfg /home/peter/.fvwm/Config_1
+ I Restart

DestroyFunc RestartFunction
AddToFunc RestartFunction
Read $[Cfg]

AddToMenu  MenuFvwmRoot "ChoiceMenu"
+ "ChoiceMenu" Popup ChoiceMenu

And that gave the result that i got stuck only using one of the config files (variable newer refreshed.?).

What i need is some advice how to

  1. Clean up the environment variable(s).
  2. help find the error if its not with not cleaned variable.
    and
    3, How to call restart with fixed parameters (eg, the parameter Read - for the config file)
IgnoreModifiers L25

DestroyMenu ChoiceMenu
AddToMenu ChoiceMenu "ChoiceMenu" Title
+ "Config_1"    SetEnv Cfg /home/peter/.fvwm/Config_1  RestartFunction
+ "Config_2"    SetEnv Cfg /home/peter/.fvwm/Config_2  RestartFunction

I am not sure what are you trying to do here. But, SetEnv only accepts two arguments: a var name and a text string (which can also be provided by expanding another variable. If there are white spaces, then you need to quote the second argument.

You don’t need RestartFunction anymore, just use StartFunction and check for Init or Restart if you really need that.

For example:

AddToFunc StartFunction I Test (Init) do_foo
AddToFunc StartFunction I Test (Restart) do_bar

Thomas Adam wrote about this (amongst many other things) some time ago:

viewtopic.php?t=1505

Besides that, I would use another approach. Just use a symlink. ~/.fvwm/config should be a symlink, update it to point to any config you want to try and then just restart. It’s simpler. You can parametrize the thing a bit:

DestroyMenu ChoiceMenu
AddToMenu ChoiceMenu "ChoiceMenu" Title
+ "Config_1"    set_cfg my_config_file_1
+ "Config_2"    set_cfg my_config_file_2
+ "Config_3"    set_cfg my_config_file_3
+ "Config_4"    set_cfg my_config_file_4

DestroyFunc set_cfg
AddToFunc set_cfg
+ I Exec echo ln -sf \"$0\" $[HOME]/.fvwm/config
+ I Echo Restart

Before making anything, make sure that you move your current ~/.fvwm/config file elsewhere.

Untested, it should work as I can tell. Of course, make also sure that you modify that sample menu with the names of correct config files.

All these elaborate suggestions when:

+ I Restart fvwm -f /some/file

Is all that’s needed.

(No need for RestartFunction either, as per the aforementioned post by me already linked to.)

– Thomas Adam

True. It all depends if you want to make the change persistent.

Thankyou Thomas, exactly what i needed.

If we assume that the file i have my configuration in is named .config
Is it possible to send Read /path/.config as a parameter to the restart command.?
(I want to ‘inherit’ some settings (obs .- the quotes - i know its not ‘true’ inherit’) from my .config .?

As i do for now is that i put that read statement in each config file i use, and i feel that that it is not the most elegante solution.

+ I Restart fvwm -f /some/file -c 'Read someOtherFile' -c 'Read someFile'

Hence FVWM will read /some/file first, then someOtherFile then SomeFile.

– Thomas Adam

That made the trick - thank you so much Thomas Adam

/Peter