In fact that approach doesn't seem to work, sorry.
It's because the .xinitrc script is called by xinit after the X server is launched.
So it cannot be used to run an interactive bash command when the graphical environment is already started.
So you were right to say "startx only works for one DE/WM at a time".
The only way I see now is to create several .xinitrc, with different names of course, for each WM, and pass one as parameter to startx, using a new script, for example named 'startwm', which you run instead of startx :
Code:
#!/bin/bash
# script startwm, to use instead of startx
select wm in Xfce Fluxbox nothing; do
case $wm in
Xfce) startx $HOME/.xinitrc-xfce4;;
Fluxbox) startx $HOME/.xinitrc-fluxbox;;
nothing) break;;
esac
done
with $HOME/.xinitrc-xfce4:
Code:
#!/bin/bash
...
exec ck-launch-session dbus-launch startxfce4
and $HOME/.xinitrc-fluxbox
Code:
#!/bin/bash
...
exec ck-launch-session dbus-launch fluxbox
Replace ... with other commands which are present in the original .xinitrc script.
That's something you could try. Tell me if that works.