diff options
author | Jonathan Bauer | 2014-01-29 17:06:16 +0100 |
---|---|---|
committer | Jonathan Bauer | 2014-01-29 17:06:16 +0100 |
commit | 88feb32f917b3d6be908d41dac8e74b229dac2ca (patch) | |
tree | 0a959efad82d80877d0db3a9bf49b8db5133b332 /remote/modules/xorg | |
parent | bye bye plymouth. You won't be missed... (diff) | |
download | tm-scripts-88feb32f917b3d6be908d41dac8e74b229dac2ca.tar.gz tm-scripts-88feb32f917b3d6be908d41dac8e74b229dac2ca.tar.xz tm-scripts-88feb32f917b3d6be908d41dac8e74b229dac2ca.zip |
[xorg] fixes for Xsession (thx ssc)
Diffstat (limited to 'remote/modules/xorg')
-rwxr-xr-x | remote/modules/xorg/data/etc/X11/Xsession | 68 |
1 files changed, 62 insertions, 6 deletions
diff --git a/remote/modules/xorg/data/etc/X11/Xsession b/remote/modules/xorg/data/etc/X11/Xsession index 63f594b5..7ba681c3 100755 --- a/remote/modules/xorg/data/etc/X11/Xsession +++ b/remote/modules/xorg/data/etc/X11/Xsession @@ -7,13 +7,46 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin" +PROGNAME=Xsession -#Workaround to start Xsession. The original Xsession script includes error handling functionality and sources other scrips from the Xsession.d/ directory. +message () { + # pretty-print messages of arbitrary length; use xmessage if it + # is available and $DISPLAY is set + MESSAGE="$PROGNAME: $*" + echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2 + if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then + echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file - + fi +} -PROFILE="/etc/profile" -if [ -e "$PROFILE" ]; then - . "$PROFILE" || slxlog "xsession" "Xsession: Could not source $PROFILE" "$PROFILE" -fi +message_nonl () { + # pretty-print messages of arbitrary length (no trailing newline); use + # xmessage if it is available and $DISPLAY is set + MESSAGE="$PROGNAME: $*" + echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2; + if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then + echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file - + fi +} + +errormsg () { + # exit script with error + message "$*" + exit 1 +} + +internal_errormsg () { + # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message + # One big call to message() for the sake of xmessage; if we had two then + # the user would have dismissed the error we want reported before seeing the + # request to report it. + errormsg "$*" \ + "Please report the installed version of the \"x11-common\"" \ + "package and the complete text of this error message to" \ + "<debian-x@lists.debian.org>." +} + +# Workaround to start Xsession. The original Xsession script includes error handling functionality and sources other scrips from the Xsession.d/ directory. SESSIONDIR="/etc/X11/Xsession.d" @@ -23,7 +56,10 @@ if [ -d "$SESSIONDIR" ]; then done fi -#start selected session +# Make sure we source the global profile - needed for ssh-agent, etc. +[ -e "/etc/profile" ] && source "/etc/profile" + +# start selected session case "$1" in failsafe) # Failsafe session was requested. @@ -41,6 +77,24 @@ case "$1" in "x-terminal-emulator not found; aborting." fi ;; + default) + # Specific program was requested. + SESSION="default" + if [ -e $HOME/.dmrc ]; then + SESSION=$(cat $HOME/.dmrc|grep "Session"| cut -d "=" -f2) + fi + # somehow .dmrc is cleared when logging in the first time after boot + if [ -e $HOME/.dmrc.real ]; then + SESSION=$(cat $HOME/.dmrc.real|grep "Session"| cut -d "=" -f2) + fi + if [ "x$SESSION" == "xdefault" ]; then + exec gnome-session --session=gnome + else + CMD=$(cat /opt/openslx/xsessions/$SESSION.desktop|grep "Exec"| cut -d "=" -f2) + exec $CMD + fi + ;; + *) # Specific program was requested. STARTUP_FULL_PATH=$(/opt/openslx/usr/bin/which "${1%% *}" || true) @@ -56,4 +110,6 @@ case "$1" in "\"$1\" not found; falling back to default session." fi ;; + esac + |