Click to See Complete Forum and Search --> : select a wm/desktop when I startx?


CB99
10-06-2000, 03:57 PM
I have a .xinitrc.MyBB which starts Blackbox, another .xinitrc.orig which starts KDE. I copy the one I want to .xinitrc.

There must be a way to pass to startx the config I want to run, like 'startx blackbox'... What would .xinitrc look like to handle that?

TIA.

slapNUT
10-06-2000, 08:36 PM
OPTIONS="KDE WindowMaker"
select opt in $OPTIONS; do
if [ "$opt" = "KDE" ]; then
echo Starting KDE
/usr/bin/startkde
exit
elif [ "$opt" = "WindowMaker" ]; then
echo Starting WindowMaker
/usr/X11R6/bin/wmaker
exit
else
clear
echo bad option
fi
done

Try pasting this into that xinitrc close to the end. This will give you a menu and you select 1 or 2 .You'll need to figure out how to add BlackBox as I don't run that one.

[This message has been edited by slapNUT (edited 06 October 2000).]

slapNUT
10-08-2000, 08:00 PM
After further review and a little thought I think you need to save the above script as .xinitrc change it as follows and leave your two .xinitrc.orig/MyBB alone:

#Chose your GUI
OPTIONS="KDE BlackBox"
select opt in $OPTIONS; do
if [ "$opt" = "KDE" ]; then
echo Starting KDE
. ./.xinitrc.orig
exit
elif [ "$opt" = "BlackBox" ]; then
echo Starting BlackBox
. ./.xinitrc.MyBB
exit
else
clear
echo bad option
fi
done


Of course the two files need to be in the same directory as this script. I think this will work better.

CB99
10-09-2000, 08:39 AM
Thanks for the suggestion. Here's my .xinitrc.

#!/bin/sh
# (c) 1999 Red Hat Software, Inc.

# Choose GUI
#
OPTIONS="KDE BlackBox"
echo About to offer menu....
select opt in $OPTIONS; do
if [ "$opt" = "KDE" ]; then
echo "Starting KDE"
. ./.xinitrc.orig
exit
elif [ "$opt" = "BlackBox" ]; then
echo Starting BlackBox
. ./.xinitrc.MyBB
exit
else
clear
echo Bad Option, Bad
fi
done

Two problems: the x server starts before I get to the menu; I have to Ctrl-Alt-F1 to stop it. Then the menu appears, but wether I type "2" or "BlackBox", nothing happens; I have to Ctrl-C to end the script.

Also, vim highlights the 'in' as an error in the line:
select opt in $OPTIONS; do

[This message has been edited by CB99 (edited 09 October 2000).]

[This message has been edited by CB99 (edited 09 October 2000).]

[This message has been edited by CB99 (edited 09 October 2000).]

slapNUT
10-09-2000, 05:06 PM
This would have been easier if I had taken the time to look at the startx script before I went off and wrote a bunch of crap that didnt help anyone!
AAAArrrrggggggghhhhhhh!
OK lets fix up this mess now. You keep the .xinitrc.<orig>/<MyBB> files the way they are. Get rid of that nasty .xinitrc file I had you create... sorry about that.
Now as root edit /usr/X11R6/bin/startx and make the following changes:

ADD THESE LINES:

if [ $1 = "bb" ]; then
userclientrc=$HOME/.xinitrc.MyBB
$1=""
else if [$1 = "kde" ]; then
userclientrc=$HOME/.xinitrc.orig
$1=""
fi
fi

Now change this line:
userclientrc=$HOME/.xinitrc
To read like this:
if [ x$userclientrc = "x" ]; then
userclientrc=$HOME/.xinitrc
fi

Thats it save startx and youre ready to go.
You do either of the following:
startx kde
startx bb
If you copy one of those .xinitrc.<orig>/<MyBB> to .xinitrc then thats your default that will start with startx.
If you want to pass server/client arguments to X then you can't specify the GUI on the command line.

<EDIT>Just to clear up whats happening. I think the first part is easy enuf, you pass either bb or kde on the command line and this determines the .xinitrc script to use. The other part we concatenate x onto the $userclientrc if the result is x then we know nothing was passed in on the command line and therefore we use default .xinitrc otherwise we leave $userclientrc alone.</EDIT>

[This message has been edited by slapNUT (edited 09 October 2000).]

CB99
10-09-2000, 05:25 PM
Thanks very much. Just the ticket.