+From the CDE FAQ: Status: RO > Common Desktop Environment FAQ > 3.1) How can I change my default window manager in CDE? > > I asked if it were possible to add other window managers such > as twm or fvwm to the CDE login. I did get a few responses saying that it > could be done, but unfortunately no one knew how. > i'm running fvwm right now. All i had to do was put: > Dtsession*wmStartupCommand: /home/orb/bin/sunos5/fvwm > in my .Xdefaults file,just change the path to wherever you put fvwm FREEKIN' HEY! I FIGGURED IT OUT! I hate to burst any die-hard CDE bubbles, but I'm a FVWM man. Have been for years. So when I first installed CDE on our system for the users, it irked me to no end that I would have to drop to the command line login in order to get my precious FVWM environment that I was so used to. For me, I could not use the above fix, for even if I were to try, I still use ssh for doing work as root on remote machines, and I needed to start the ssh-agent *before* starting the X session. To make matters even more annoying, the CDE's login never worked smoothly on our Solaris 2.5 machines -- the drop to command line login *never* works the first time, go figgure. So after searching high and low, and, barring that, hacking the darned thing myself, I managed to figgure out how to add window managers to the CDE login. Not only that, but as a bonus, I figured out how to add ssh support to the login process as well. Once I got it going, I was *SO* happy that I wanted immediately to email someone and tell them how I did it! So I thought I'd start with the FAQ maintainer... As an added bonus, I'm including a tar file of the files that I made for fvwm. All you need do is untar them in / and then restert the dtlogin damon ala step 6. Here goes: Disclaimer: I only know two things: Jack and Crap, and Jack left town. Consider yourself forewarned. 1) Create the directory structure you will need. You don't need to have a duplicate of /usr/dt in /etc/dt, only the files you want to add/replace. Specifically, you will want to create the following directories: These first directories were already installed on my new Sol 2.7. /etc/dt root:root 0755 -- The dt directory itself /etc/dt/appconfig root:root 0755 -- Application config dir I had to create the following myself: /etc/dt/appconfig/icons bin:bin 0755 -- Icon directory /etc/dt/appconfig/icons/C bin:bin 0755 -- Language specific icons /etc/dt/config root:bin 0775 -- CDE configuration /etc/dt/config/C root:bin 0775 -- Language specific configs /etc/dt/config/C/Xresources.d root:bin -- CDE login config dir All directories should be set to 0755 permissions, except config and config/C, they should be 0775. 2) Create a pair of icons for your favorite window manager. CDE will use a different icon depending on whether the display is color or monochrome. Use the XPM format for the color file, and the XBM format for the monochrome file. The default size for the built-in icons is 237x237, and if your icon is larger than that, it will get cropped by CDE's login window. When you go to save the files, CDE, for some reason, doesn't look for files ending in .xpm and .xbm. When you save the files, save the XPM color file with the extemsion .pm and the XBM B+W file with the .bm extension. Once you've created these files, place them in /etc/dt/appconfig/icons/C. I called my icons FVWMlogo.pm/FVWMlogo.bm, which fits with the naming convention CDE uses for OpenWindows with OWlogo.[pb]m, which live in /usr/dt/..../C. The file ownership and permissions on my icons are root:other, 0644. 3) Create an Xresources file for your favorite window manager. For fvwm, I called mine Xresources.fvwm. This file lives in /etc/dt/config/C/Xresources.d. The format of this file is very simple, and it is explained in the dtlogin man page. (man dtlogin and search for OWlogo in the text. It's in that general area.) You can copy /usr/dt/config/C/Xresources.d/Xresources.ow as a template. Here's mine for FVWM: ---[ /etc/dt/config/C/Xresources.d/Xresources.fvwm ]--------------------------- Dtlogin*altDtsIncrement: True Dtlogin*altDtName: FVWM Dtlogin*altDtKey: /usr/local/bin/fvwm2 Dtlogin*altDtStart: /etc/dt/config/Xsession.fvwm Dtlogin*altDtLogo: FVWMlogo ------------------------------------------------------------------------------- Leave Dtlogin*altDtsIncrement at True. Trust me, this makes everything flow smoothly. Change Dtlogin*altDtName to the name of your window manager. Dtlogin*altDtKey is the name of a file that CDE login looks for to determine whether or not that window manager is installed on that machine. Normally it is the binary of the window manager program itself, but it could be any file that's associated with that window manager. Dtlogin*altDtStart is the name of the script to run to begin the session. NOTICE: If you have copied Xresources.ow from /usr/dt/... as a template, MAKE SURE to change the /usr to /etc, or you'll spend hours pulling your hair out like I did. Dtlogin*altDtLogo is the basename of the icon file to display when this icon manager has been selected. This is the file that we created in step 1. Notice that the extension is not listed. 3) Create the Xsession. file. I copied the OpenWindows one in /usr/dt/config/, called Xsession.ow. Place the file in /etc/dt/config, and give it bin:bin 0555 permissions and ownership. NOTICE: MAKE SURE you use the same filename that you placed in the Xresources file in step 2 above, or again, you'll spend a lot of time pulling your hair out. If you copy the OpenWindows file and edit it, there are a few things to keep in mind. First, you want to change any references to /usr/dt/config/... to their counterpart in /etc/dt/config/... Don't worry if the file doesn't exist yet, we haven't gotten that far. Just trust me. Another thing you will want to do is change the text used by the dthello program from 'Starting the OpenWindows Desktop' to 'Starting the Desktop'. As an added bonus, if you like to use ssh, as I do, then this is where to start the ssh-agent, and I'll show you how I do it. Here's how my file looks for FVWM. The comment sections I added to show you what I changed. Read 'em or suffer the same mistakes that I did: ---[ /etc/dt/config/Xsession.fvwm ]-------------------------------------------- #!/bin/ksh DTDSPMSG=/usr/dt/bin/dtdspmsg if [ -z "$SESSIONTYPE" ] then export SESSIONTYPE="altDt" fi if [ -z "$DTSTARTIMS" ] then export DTSTARTIMS="False" fi ########################################################################### # # I changed the following reference to point to /etc from /usr, and from # Xsession.ow2 to Xsession.fvwm2. No, the 2 on the end is not a typo. If you # give CDE login the name of *this* file, it'll loop forever. (Well, not # forever. Eventually it'll run out of memory and barf, as I found out. :) # ########################################################################### if [ -z "$SDT_ALT_SESSION" ] then export SDT_ALT_SESSION="/etc/dt/config/Xsession.fvwm2" fi ########################################################################### # # I changed the following text in dthello from 'OpenWindows' to 'FVWM'. # ########################################################################### if [ -z "$SDT_ALT_HELLO" ] then if [ -x $DTDSPMSG ]; then export SDT_ALT_HELLO="/usr/dt/bin/dthello -string '`$DTDSPMSG -s 37 /usr/dt/lib/nls/msg/$LANG/dthello.cat 1 'Starting the FVWM Desktop'`' &" else export SDT_ALT_HELLO="/usr/dt/bin/dthello -string 'Starting the FVWM Desktop' &" fi fi export SDT_NO_DSDM="" ########################################################################### # # Here's where I check to see if my ssh package is installed. If it is, then I # test to find out where it's installed (/usr on my ststem) and then set the # SSH_AGENT variable appropriately. You can get by with less, but the nice # thing about this is it takes advantage of the fact that I've made ssh a # package, and yet if said package isn't installed, it doesn't make dtlogin # barf. # # You could get by with something like this: # # if [ -x /....../bin/ssh-agent ]; then # SSH_AGENT=/....../bin/ssh-agent # else # SSH_AGENT= # fi # ########################################################################### SSH_PACHAGENAME="ssh" /bin/pkginfo -q ${SSH_PACKAGENAME} if [ $? -eq 0 ]; then SSH_BASEDIR=`/bin/pkginfo -r ssh` SSH_AGENT=${SSH_BASEDIR}/bin/ssh-agent else SSH_AGENT= fi ########################################################################### # # Start the session. Notice that if I don't have SSH installed, then the # SSH_AGENT variable is empty, and the following line only runs the session # manager script by itself. (I thought that was rather slick of me. :) # ########################################################################### ${SSH_AGENT} /usr/dt/bin/Xsession ------------------------------------------------------------------------------- 4) You'll notice that in step 3 we made a reference to the script Xsession.fvwm2, which doesn't exist. Now it's time to create it. Again, I copied /usr/dt/config/Xsession.ow2 and edited it. Place the file in /etc/dt/config and give it bin:bin 0555 ownership and permissions. NOTICE: Make sure that the filename matches up with the file referenced in step 3 above! The number of changes that I had to make to this file are few. Again, I changed any references from any files in /usr/dt/config to /etc/dt/config. I also added /usr/local/bin to the PATH variable so that fvwm could find it's own files. I also changed the echo statement from OpenWindows to FVWM. Here's what it looks like: ---[ /etc/dt/config/Xsession.fvwm2 ]------------------------------------------- unset SDT_ALT_SESSION unset SDT_ALT_HELLO unset SDT_NO_DSDM ########################################################################### # # Change the DEFAULT_XINITRC file to the one that we will create for fvwm. # Don't forget to change /usr to /etc or you'll be sorry! I also added # /usr/local/bin to the path so that fvwm could find itself. # ########################################################################### DEFAULT_XINITRC="/etc/dt/config/Xinitrc.fvwm" HOME_XINITRC="$HOME/.xinitrc" PATH=/usr/local/bin:/usr/dt/bin:$PATH:/usr/openwin/bin export PATH if [ -z "$XINITRC" ]; then if [ -f $HOME_XINITRC ]; then XINITRC=$HOME_XINITRC else XINITRC=$DEFAULT_XINITRC fi fi ########################################################################### # # In my traditional anal-retentive fashion, I also changed the following echo # statement, not that it has any outcome on the functioning of the script or # anything. # ########################################################################### echo "FVWM Desktop Login" if [ -f $XINITRC ]; then echo "using xinitrc file: $XINITRC" /bin/ksh $XINITRC else echo "xinitrc file: $XINITRC not found" if [ -f $DEFAULT_XINITRC ]; then echo "using xinitrc: $DEFAULT_XINITRC" /bin/ksh $DEFAULT_XINITRC fi fi ------------------------------------------------------------------------------- 5) We're almost there. Now all we have to do is create the default xinitrc file. Again, I copied mine from /usr/dt/config/Xinitrc.ow. Place the file in /etc/dt/config and give it the same filename that you placed in the second Xsession file from step 4 above. Make it owned by bin:bin and give it 0444 permissions. I butchered my file, as I didn't need most of what OpenWindows had. Here's what my file looks like: ---[ /etc/dt/config/Xinitrc.fvwm ]--------------------------------------------- if [ -f $HOME/.Xdefaults ]; then xrdb -merge $HOME/.Xdefaults # Load Users X11 resource database fi eval `locale_env -env` # Set Locale Environment PATH=/usr/local/bin:$PATH export PATH /usr/local/bin/fvwm2 ------------------------------------------------------------------------------- Woops, I don't remember adding /usr/local/bin to the path again. Oh well, your mileage may varry. 6) Stick yourself on a fork, you're done! Now all you have to do is restart the dtlogin daemon by typing /etc/init.d/dtlogin stop, followed by /etc/init.d/dtlogin start. Pat yourself on the back and go grab a rootbeer, by the time you get back, dtlogin will be back up and ready to roll! Test the login by, what else, logging in. You should be able to select Options --> Session and see your window manager listed among the alternatives to CDE. If you don't, then you need to check that /etc/dt/config/C/Xresources.d/Xresou- rces. file is where it should be, contains what it should contain, and has the correct permissions and ownership. Once you've selected your alternative window manager, you should see your icon come up in the window to the right. If it doesn't check the reference in the Xresources file and make sure that the filename matches up with the files in /etc/dt/appconfig/icons/C. Also make sure that the extensions on the icon files are .pm for the XPM file and .bm for the XBM file. Baring that, check the permissions to be sure that the files are readable by everyone. If you get that far, and you get a login incorrect, then either you typed in your password wrong, or something is wrong with the first Xsession file. Check that the reference listed in /etc/dt/config/C/Xresources.d/Xresour- ces. matches the filename of the script in /etc/dt/config. Then check that the file has the correct ownership and permissions, and check that it has the correct contents. In my laborious debugging efforts, I found ~/.dt/errorlog and ~/.dt/startlog to be useless for detecting problems at this stage. Instead, I added 'echo "Im here" > /tmp/log' to different files to check that they were indeed being executed. If the first Xsession file checks out, check the reference to the second Xsession file and see that it matches the pathname to the file that exists. Also check the ownership and permissions of the second file and see that it's cochure. I used the same echo trick as above and found that my path in the first Xsession file still pointed to /usr instead of /etc -- my second Xsession file was never being run. If the Xsession files are okay, *then* I start seeing useful output to ~/.dt/errorlog and ~/.dt/startlog. Then it's just a simple matter of checking the /etc/dt/Xinitrc. file and making sure that it's found and executed. By this stage in the game, you should have access to a function called Log that's defined in /usr/dt/bin/Xsession. You can use that to log useful debugging statements in the Xinitrc file. Also, if you have a file in your home area called ~/.xinitrc, then *that* file is run instead. You may want to check it, too. I checked my login using my root account, as root doesn't have any ~/.x* files. Also, make sure that you aren't doing any- thing screwy in your ~/.xinitrc file that is causing a conflict with CDE's login process. Finally, the last thing to check is that the window manager's default configuration file can be found by the window manager program. I finally pulled the remainder of my hair out before I realized that the reason I wasn't seeing anything useful on my screen was that fvwm couldn't find the system.fvwm2rc file. Again, if you have rolled your own in your home area, then (a) you won't have to worry about the window manager finding the system default, and (b) you WILL have to worry about any conflicts that your personal file may (or may not) cause with the CDE login process. Again, your mileage may varry. Okay, that's it. In little while I will have added logins for each of our system's window managers to CDE, and then I'll be sittin' fat! (Well, in more ways than one... :) Take care, God bless, and don't let the Y2K bug bit28@#&*^ NO CARRIER -- Michael Peek ------------------------------------------------------------------------------ Systems Administrator / C++ Database Programmer 569 Dabney Hall Department of Ecology and Evolutionary Biology Knoxville, TN 37996-1610 University of Tennessee at Knoxville ------------------------------------------------------------------------------ (423)974-0224 phone, (423)974-3067 fax http://www.tiem.utk.edu/~peek