2
# temporary storage of error messages
3
## THESE exist for the scripts in Xsession.d
5
# pretty-print messages of arbitrary length; use xmessage if it
6
# is available and $DISPLAY is set
7
MESSAGE="$PROGNAME: $*"
8
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
9
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
10
echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
15
# pretty-print messages of arbitrary length (no trailing newline); use
16
# xmessage if it is available and $DISPLAY is set
17
MESSAGE="$PROGNAME: $*"
18
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
19
if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
20
echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
25
# exit script with error
30
internal_errormsg () {
31
# exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
32
# One big call to message() for the sake of xmessage; if we had two then
33
# the user would have dismissed the error we want reported before seeing the
34
# request to report it.
36
"Please report the installed version of the \"x11-common\"" \
37
"package and the complete text of this error message to" \
38
"<debian-x@lists.debian.org>."
41
LOG="$HOME/.toriOS-xinit.log"
3
42
ERR=$(mktemp --tmpdir config-err-XXXXXX)
44
echo "$USER" >> "$LOG"
5
45
source_with_error_check () {
7
echo "Loading $CONFIG_FILE"
47
echo "Loading $CONFIG_FILE" >> "$LOG"
8
48
. "$CONFIG_FILE" 2>"$ERR"
9
49
if [ -s "$ERR" ]; then
12
52
cat "$ERR" >>/dev/stderr
13
53
truncate -s 0 "$ERR"
15
55
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
17
# start up stuff in $XDG_CONFIG_HOME/autostart/
18
if test -d "$XDG_CONFIG_HOME/autostart"; then
19
for i in ${XDG_CONFIG_HOME}/autostart/*.desktop; do
57
# start up stuff in $HOME/autostart/
58
if test -d "$HOME/autostart"; then
59
for i in "${HOME}"/autostart/*.desktop; do
20
60
grep -q -E "^Hidden=true" "$i" && continue
21
61
if grep -q -E "^OnlyShowIn=" "$i"; then
22
62
# need to test twice, as lack of the line entirely means we still run it
26
66
# check for TryExec
27
67
trycmd=$(grep -E "^TryExec=" "$i" | cut -d'=' -f2)
28
68
if test "$trycmd"; then
69
echo "$trycmd" >> "$LOG"
29
70
which "$trycmd" >/dev/null 2>&1 || continue
32
73
cmd=$(grep -E "^Exec=" "$i" | cut -d'=' -f2)
33
74
if test "$cmd" && which "$cmd" >/dev/null 2>&1; then
75
echo "loading autostart: $cmd" >> "$LOG"
60
102
xresourcedir="/etc/X11/Xresources"
61
103
if [ -d "$xresourcedir" ]; then
62
104
for file in $xresourcedir/*; do
63
echo "Loading resource: $file"
105
echo "Loading resource: $file" >> "$LOG"
64
106
xrdb -nocpp -merge "$file"
67
109
xresourcefile="$HOME/.Xresources"
68
110
if [ -f "$xresourcefile" ]; then
69
echo "Loading resource: $xresourcefile"
111
echo "Loading resource: $xresourcefile" >> "$LOG"
70
112
xrdb -nocpp -merge "$xresourcefile"
75
117
if type setxkbmap >/dev/null 2>&1; then
76
118
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
77
119
if [ -f "$file" ]; then
78
echo "Loading keymap: $file"
120
echo "Loading keymap: $file" >> "$LOG"
79
121
setxkbmap "$(cat "$file")"
100
142
xinitdir="/etc/X11/xinit/xinitrc.d"
101
143
if [ -d "$xinitdir" ]; then
102
144
for script in $xinitdir/*; do
103
echo "Loading xinit script $script"
145
echo "Loading xinit script $script" >> "$LOG"
104
146
if [ -x "$script" -a ! -d "$script" ]; then
110
152
# Load Xsession scripts
111
153
# OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
112
154
# by the scripts to work
156
## Should I just use:
157
# . /etc/X11/Xsession
113
160
xsessionddir="/etc/X11/Xsession.d"
114
161
OPTIONFILE=/etc/X11/Xsession.options
115
162
USERXSESSION=$HOME/.xsession
116
163
USERXSESSIONRC=$HOME/.xsessionrc
117
164
ALTUSERXSESSION=$HOME/.Xsession
166
## Modified slightly to be more like Xsession script
118
167
if [ -d "$xsessionddir" ]; then
119
for script in $xsessionddir/*; do
120
echo "Loading X session script $script"
168
SESSIONFILES=$(run-parts --list $xsessionddir)
170
for script in $SESSIONFILES; do
171
echo "Loading X session script $script" >> "$LOG"
121
172
if [ -r "$script" -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
127
179
if which jwm >/dev/null 2>&1; then
128
180
if which ck-launch-session >/dev/null 2>&1; then
181
echo "running: ck-launch-session jwm" >> "$LOG"
129
182
ck-launch-session jwm
131
# start ToriOS normally
184
echo "running: jwm" >> "$LOG"
188
echo "Missing jwm and ck-launch-session" >> "$LOG"