~torios-dev/torios/trunk

« back to all changes in this revision

Viewing changes to start/.xinitrc

  • Committer: Israel Dahl
  • Date: 2015-01-08 03:44:35 UTC
  • Revision ID: israel@torios.org-20150108034435-1r0ithi6zax8dy62
removed pointless files
added networkmanager polkit rule
added basic places menu (incase old menu gets deleted, or is somehow missing)
modified live jwmrc to be correct and working.
modified xinitrc to be inline with Xsession file
removed cruft from starttorios
added some funny scripts that don't get installed yet (cd.. is like sl)

* modified scripts slightly to mimic Xsession file
* added networkmanager pkla
* moved out other background files 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env bash
2
 
# temporary storage of error messages
 
2
PROGNAME=$0
 
3
## THESE exist for the scripts in Xsession.d
 
4
message () {
 
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 -
 
11
  fi
 
12
}
 
13
 
 
14
message_nonl () {
 
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 -
 
21
  fi
 
22
}
 
23
 
 
24
errormsg () {
 
25
  # exit script with error
 
26
  message "$*"
 
27
  exit 1
 
28
}
 
29
 
 
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.
 
35
  errormsg "$*" \
 
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>."
 
39
}
 
40
 
 
41
LOG="$HOME/.toriOS-xinit.log" 
3
42
ERR=$(mktemp --tmpdir config-err-XXXXXX)
4
 
 
 
43
date > "$LOG"
 
44
echo "$USER" >> "$LOG"
5
45
source_with_error_check () {
6
46
    CONFIG_FILE="$1"
7
 
    echo "Loading $CONFIG_FILE"
 
47
    echo "Loading $CONFIG_FILE" >> "$LOG"
8
48
    . "$CONFIG_FILE" 2>"$ERR"
9
49
    if [ -s "$ERR" ]; then
10
 
        echo "$ERR"
 
50
        echo "$ERR" >> "$LOG"
11
51
    fi
12
52
    cat "$ERR" >>/dev/stderr
13
53
    truncate -s 0 "$ERR"
14
54
}
15
55
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
16
56
## taken from Xfce
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
30
71
    fi
31
72
 
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"
34
76
      $cmd &
35
77
    fi
36
78
  done
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"
65
107
        done
66
108
    fi
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"
71
113
    fi
72
114
fi    
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")"
80
122
            XKB_IN_USE=yes
81
123
        fi
87
129
    if [ -z "$XKB_IN_USE" ]; then
88
130
        for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
89
131
            if [ -f "$file" ]; then
90
 
               echo "Loading modmap: $file"
 
132
               echo "Loading modmap: $file" >> "$LOG"
91
133
               xmodmap "$file"
92
134
            fi
93
135
        done
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
105
147
            . "$script"
106
148
        fi
110
152
# Load Xsession scripts
111
153
# OPTIONFILE, USERXSESSION, USERXSESSIONRC and ALTUSERXSESSION are required
112
154
# by the scripts to work
 
155
 
 
156
## Should I just use:
 
157
#   . /etc/X11/Xsession
 
158
## instead???????
 
159
 
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
 
165
 
 
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)
 
169
  set +e
 
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
122
173
            . "$script"
123
174
        fi
124
175
    done
 
176
    set -e
125
177
fi
126
178
 
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
130
183
    else
131
 
      # start ToriOS normally
 
184
        echo "running: jwm" >> "$LOG"
132
185
      jwm
133
186
    fi
134
187
else
 
188
  echo "Missing jwm and ck-launch-session"  >> "$LOG"
135
189
  exit 0
136
190
fi
137
191