[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Here's my .xsession (was Re: User-selected window-manager in an easy way)



Here's my .xsession... it assumes the window manager is not the session
controller, and something else is (but that can be changed pretty easily)

---

file: .xsession

---
#!/bin/bash

#
# logout button .xsession allowing fav window mgr by Jim Lynch
#
# This .xsession prepares for gnome by having something other than
# the window mgr be in the foreground, such as a logout button.
#
# As always, when the foreground process goes away, the session ends.
# This is true whether the fore is a wm, a logout-button or a session
# manager separate from the wm.
#
# This .xsession has logout-button be the foreground process. Pushing the
# logout button causes the logout button process to end, which implies 
# the .xsession foreground process ends, which ends the session.
#
# This .xsession will also launch xearth and an xterm.

# Now find a window manager... we want one that's installed... run it...

# start by assuming that before we start looking, we haven't found anything
foundWM=false

echo "1 $foundWM"

# Favorite window manager

# set this to your favorite WM, or to nothing if you're willing to accept
# whatever comes
myWM=fvwm2

if [ "$foundWM" = "false" ]
then
    favWM=`grep $myWM /etc/X11/window-managers | head -1`
    aWM=`echo $favWM | sed 's/#.*//'`

    if [ -x "$aWM" ]
    then
	theWM=$aWM
	foundWM=true
    fi
fi

echo "2 $foundWM"

if [ "$foundWM" = "false" ]
then
    if [ -e /etc/X11/window-managers ]
    then
	for i in `sed 's/#.*//' /etc/X11/window-managers`
	do
	    if [ -x $i ]
	    then
		theWM=$i
		foundWM=true
		break
	    fi
	done
    fi
fi

echo "3 $foundWM"

# still didn't find a wm?? OK, twm isn't the best, but we'll settle

if [ "$foundWM" = "false" ]
then
    theWM=twm
    foundWM=true
fi

echo "4 $foundWM"

# launch the selected or otherwise found window manager in the background.

$theWM &

# launch xearth and an xterm.
xearth &
#xfishtank &
#xterm -ls &

# launch the session-controlling process. If it dies, so does the session.

#exec logout-button
exec gnome-session

# end of .xsession

# Here's the original .xsession

# #!/bin/bash
# 
# # NOTE: this part taken from the else part of the final "if"
# # in the global /etc/X11/Xsession by jim@laney.edu
# #
# # i.e., look at this code as the default behavior and
# # modify to taste
#
# xterm -ls &
# if [ -e /etc/X11/window-managers ]; then
#   for i in `sed 's/#.*//' /etc/X11/window-managers`; do
#     if [ -x $i ]; then
#       exec $i
#     fi
#   done
# fi
# exec twm
---


Reply to: