forked from iwamatsu/slim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xinitrc.sample
111 lines (99 loc) · 2.49 KB
/
xinitrc.sample
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
103
104
105
106
107
108
109
110
111
# -*- shell-script -*-
# edit to suit your system
# save to ~/.xinitrc or ~/.xsession
# # ~$ man startx for more information
# allocate your startx or default xinit preference
# Devuan default for jessie or ascii is xfce4 :
# see the case statement below for examples
DEFAULT_SESSION=openbox-session
if test -x dbus-launch ; then
# there is system dbus infrastructure
DB_LAUNCH=$(which dbus_launch)
DB_L_OPTIONS="--auto-syntax --exit-with-session"
DBL="${DB_LAUNCH} ${DBL_OPTIONS}"
# _any_ dbus sessions sockets left unconnected...
/usr/bin/dbus-cleanup-sockets || true
else
DBL=""
fi
if [ -z $1 ]; then
# no option for xinit or using startx ?
# then just jump to default
exec $DBL $DEFAULT_SESSION
fi
### everything above here makes for a nice minimal file
if [ ! -z $1 ];
then
echo "asking for session $1"
# $1 hopefully maps to
# one of these executables like so:
case $1 in
xfce4* )
exec $DBL xfce4-session
;;
fluxbo* | flux )
# see also: ~/.fluxbox/startup
exec $DBL startfluxbox
;;
mate* )
exec $DBL mate-session
;;
openbo* | ob )
# see also your personal: ~/.config/openbox/autostart
exec $DBL openbox-session
;;
dwm )
# it is OK to not have xbindkeys
xbindkeys || true &
xterm -e /bin/bash &
exec $DBL dwm
twm )
xbindkeys || true &
xterm -e /bin/bash &
exec $DBL twm
;;
icewm )
icewmbg &
icewmtray &
exec $DBL icewm
;;
wmaker )
exec $DBL wmaker
;;
blackb* )
exec $DBL blackbox
;;
*)
if [ -x $1 ]; then
# user always knows best
exec $DBL $1
else
exec $DBL $DEFAULT_SESSION
fi
;;
esac
fi
# some wicket-keeps or backstops
if [ ! -x $1 ]; then
cat <<EOEM
ALERT: Slim has Failed to launch any X environment.
Unable to execute: "$1"
Try xinit or startx with _no options_ for $DEFAULT_SESSION
or if "server in use"
Try: xinit -- :2
finally try: startx sh
EOEM
else
# we have to hope $1 is some argument an xterm understands
echo "Trying fallback X access. Hand focus any xterms or windows"
xterm -e $1 || xterm &
exec $DBL $DEFAULT_SESSION
fi
### never give up and *assuming* one is on an actual tty ###
if [ "$?" != "0" ]; then
echo -e "\ntry:\t xinit -- :$(tty | tr -d /dev/tty) or say :3"
echo -e "or plain startx "
fi
# exit without error
# so as not to hang up logins (or "boots") on actual errors
exit 0