Location of configuration file

How can I find out which configuration file fvwm is currently using?

‘man fvwm’ – look at the INITIALIZE section. Essentially FVWM looks for the following files in the following order and will use the first one it finds:

           $HOME/.fvwm/config
            /usr/local/share/fvwm/config

            $HOME/.fvwm/.fvwm2rc
            $HOME/.fvwm2rc
            /usr/local/share/fvwm/.fvwm2rc
            /usr/local/share/fvwm/system.fvwm2rc
            /etc/system.fvwm2rc

If you happen to start fvwm with the “-f” flag, then “ps aux” as a command will show it, however, using the above method is much more accurate.

– Thomas Adam

I was thinking of a possibility of displaying that information inside a FvwmButton. But I don’t know how to proceed, other than I’m going to need the “$.” variable I guess. But with what and how, I don’t know. Thanks.

You could try something like this:

Have a file called “configs” that holds all your values:

$HOME/.fvwm/config
/usr/local/share/fvwm/config
$HOME/.fvwm/.fvwm2rc
$HOME/.fvwm2rc
/usr/local/share/fvwm/.fvwm2rc
/usr/local/share/fvwm/system.fvwm2rc
/etc/system.fvwm2rc 

Then you can do something like this:

while read c; do [ -f "$(eval $c)" ] || { echo "$c" && break;}; done < ./configs 2>/dev/null

Of course, if you wanted to make that global then you can do:

PipeRead 'while read c; do [ -f "$(eval $c)" ] || { echo "SetEnv myConfig $c" && break;}; done < ./configs 2>/dev/null'

Echo $[myConfig]

… and all of that is assuming that FVWM hasn’t been started with the “-f” flag. If it has then it won’t matter about any of the ordering in the above as it has been overriden, so you can check for that using pgrep and so on and so forth.

I thought that fvwm-config might have helped, but then I realised that it probably wouldn’t, since a configuration is a runtime issue.

– Thomas Adam

Thanks Thomas, I wondered myself the possibility of using fvwm-config.

Although by no doubt it would work fine with the above, but if I did it that way I might as well “hard-code” the text into a FvwmButton label.

I take it there is no way to produce, say,
[imaginatory code]
*FvwmButton: (Swallow “unknown” Echo $. | xmessage -file -)
[/imaginatory code]
or something similar, to have a more generic way. I understand the above would (if it worked) only display the lastly read-in file, but that isn’t a problem at least for me.

I guess the real problem here is that I don’t understand how to get a Fvwm-environmental variable available to an outside-fvwm command.

Oh, and I’ve never used the -f -switch, so that is no problem :slight_smile:

That would be easier. :slight_smile:

This comes down to how processes inherit their environment. You will only be able to make an environment variable available to an application if the application is spawn from within FVWM (since the environment variable is placed within that and any children inherit from their parent). So for instance, if you do:

SetEnv foo somevalue

… then open an application, say XTerm, and do:

FvwmCommand "Echo $[foo]"

You’ll see the value printed to ~/.xsession-errors.

Does that help? Of course, subshells cannot update their parent.

– Thomas Adam

Humm, okay. Thanks for the assistance. It’s really odd that fvwm has no means to display the configuration file it is currently using. :frowning:

It would not be too difficult to patch FVWM to add this functionality.

Thomas.