Debian Codegraph @

debian/miwm-session

raw
1 #!/bin/sh
2 #
3 # Copyright
4 #
5 # Copyright (C) 2009-2010 Jari Aalto <[email protected]>
6 #
7 # License
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 LICENSE="GNU GPL v2 or (at your option) any later"
23 AUTHOR="[email protected]"
24 VERSION="2009.1230.2335"
25 CONF="$HOME/.miwm/session"
26
27 Help ()
28 {
29 echo "\
30 As MIWM does not have any meny by default to start external programs,
31 this file starts one terminal with the window manager.
32
33 This program is designed to be used by GDM (etc) from
34 /usr/share/xsessions/miwm.desktop and therefore this program
35 does not exit until Window Manager exists."
36 exit 0
37 }
38
39 Version ()
40 {
41 echo "$VERSION Copyright (C) $AUTHOR $LICENSE"
42 exit 0
43 }
44
45 Warn ()
46 {
47 echo "$*" >&2
48 }
49
50 Term ()
51 {
52 if [ -e /usr/bin/x-terminal-emulator ]; then
53 x-terminal-emulator -display ${DISPLAY:-":0"} &
54 else
55 Warn "$0: No x-terminal-emulator to start"
56 fi
57 }
58
59 Session ()
60 {
61 if [ -f $CONF ]; then
62 sh $CONF
63 else
64 Term
65 fi
66 }
67
68 Main ()
69 {
70 while :
71 do
72 case "$1" in
73 -h|--help)
74 Help
75 ;;
76 -V|--version)
77 Version
78 ;;
79 *) break
80 ;;
81 esac
82 done
83
84 log=${TMPDIR:-/tmp}/${LOGNAME:-$USER}$$.miwm.log
85
86 { sleep 4; Session ; } &
87 miwm "$@" 2>&1 | tee $log
88 }
89
90 Main "$@"
91
92 # End of file