Custom calls to fvwm from lightdm under Ubuntu 12.04

Using Ubuntu Hardy, I called fvwm from within console mode, using startx.

Before running startx, I would set a large number of environment variables using console commands. These variables would then be read by my fvwm startup script, to define terminal geometry, fonts etc. Because I use a number of different terminals, I had several different vectors of environment variables that I would alternate between.

Now I’m running Ubuntu 12.04.and it no longer works to call fvwm from startx in console mode (for some dumb reason the sound doesn’t work unless I call fvwm from lightdm. Can anybody suggest a way that I can pass environment variables to fvwm in a flexible way (i.e., different variable settings for different terminal setups) while calling fvwm from a GUI such as lightdm?

Thanks for any suggestions!

NOTE: edited as originally typed ‘.Xresources’ instead of ‘.xsession’. Also minor edits to increase clarity

to use fvwm with lightdm you can add the following:

[Desktop Entry]

to /usr/share/xsessions/custom.desktop

then define a .xsession file in your $HOME directory with something like:
exec /path_to_fvwm/fvwm

I think .xsession might need +x permissions.

then restart lightdm via:

sudo service lightdm restart

This will make fvwm work - it will be now availabe from the lightdm menu when the computer first boots.

In principle you should also be able to define environmental variables before the ‘exec’ call. I personally prefer to define my variables all within the .fvwm2rc file (you can use Piperead and if statements to make them conditional), but that’s up to you.