forked from dnschneid/crouton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnome-session-wrapper
executable file
·40 lines (33 loc) · 1.18 KB
/
gnome-session-wrapper
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
#!/bin/sh -e
# Copyright (c) 2016 The crouton Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Provides a wrapper around gnome-session to allow gnome-session based
# desktop environments to work with crouton nicely
USAGE="${0##*/} [session]
A wrapper around gnome-session that can be passed to xinit.
Provide the session type in the DESKTOP_SESSION variable,
or as an optional session argument.
Examples:
(launch GNOME from crosh with session in DESKTOP_SESSION)
DESKTOP_SESSION=gnome xinit /etc/X11/xinit/xinitrc ${0##*/}
(launch Unity from an xterm with session as an argument)
${0##*/} ubuntu"
export DESKTOP_SESSION="${DESKTOP_SESSION:-"$1"}"
SESSION='gnome-session'
CINNAMON_SESSION='cinnamon-session'
if [ -z "$DESKTOP_SESSION" ]; then
echo "$USAGE" 1>&2
exit 2
fi
# Cinnamon 2.0 and later uses its own fork of gnome-session
if [ "${DESKTOP_SESSION#cinnamon}" != "$DESKTOP_SESSION" ] && \
hash "$CINNAMON_SESSION" 2>/dev/null; then
SESSION="$CINNAMON_SESSION"
fi
if [ -z "$DISPLAY" ]; then
exec xinit /etc/X11/xinit/xinitrc "$0"
else
exec "$SESSION" --session="$DESKTOP_SESSION"
fi