File: example.xsession

package info (click to toggle)
logout-button 19980721-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 84 kB
  • ctags: 7
  • sloc: sh: 69; makefile: 58; cpp: 30
file content (102 lines) | stat: -rw-r--r-- 2,511 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/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

# Favorite window manager

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

# try to find my favorite wm
if [ "$foundWM" = "false" ]
then
    favWM=`grep -v "^#" /etc/X11/window-managers | sed 's/#.*//' | grep "$myWM" | head -1`
    
    if [ -x "$favWM" ]
    then
	theWM=$favWM
	foundWM=true
    fi
fi

# try to find ANY wm (the first one found to be executable)
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

# 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

# launch the selected or otherwise found window manager in the background.
# !!note!! the window manager is NOT the foreground process because it is
#          NOT the session controller (as would have been the traditional case)

$theWM &

xearth &
#xfishtank &
#xterm -ls &

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

exec logout-button
# exec gnome-session # maybe you'll try a different session mgr later :)

# 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 session 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