[X2Go-Commits] [live-build-x2go] 58/108: moving X startup related things from config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig to config/includes.chroot/etc/X11/Xsession.d/60x11-*

git-admin at x2go.org git-admin at x2go.org
Wed Mar 20 22:13:16 CET 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch feature/openbox
in repository live-build-x2go.

commit afefc032b9a83456d3a999f0938d15f9563d815a
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Sun Dec 16 01:54:12 2018 +0100

    moving X startup related things from config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig to config/includes.chroot/etc/X11/Xsession.d/60x11-*
---
 .../etc/X11/Xsession.d/60x11-blanking-dpms-config  | 31 +++++++++
 .../etc/X11/Xsession.d/60x11-openbox-start         |  4 ++
 .../etc/X11/Xsession.d/60x11-set-background        | 43 +++++++++++++
 .../Xsession.d/60x11-spawn-configure-pulseaudio    | 32 ++++++++++
 .../lib/live/config/2900-x2go-thinclientconfig     | 74 ----------------------
 5 files changed, 110 insertions(+), 74 deletions(-)

diff --git a/config/includes.chroot/etc/X11/Xsession.d/60x11-blanking-dpms-config b/config/includes.chroot/etc/X11/Xsession.d/60x11-blanking-dpms-config
new file mode 100644
index 0000000..128c503
--- /dev/null
+++ b/config/includes.chroot/etc/X11/Xsession.d/60x11-blanking-dpms-config
@@ -0,0 +1,31 @@
+# code to fix blank screen happening with DisplayPort and some buggy TFTs (xset q reports "Monitor is on" even though it is pitch black)
+if grep -q '\W*blankdpmsfix\W*' /proc/cmdline; then
+        xset dpms force suspend
+fi
+
+BLANKINGTIME=$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | awk -F '=' '$1 == "blank" { print $2 }' | tr -dc '0-9:')
+if [ -n "$BLANKINGTIME" ]; then
+        DPMSARR=($(echo $BLANKINGTIME | awk -F ':' '$1 ~/^[0-9]*$/ && $2 ~/^[0-9]*$/ && $3 ~/^[0-9]*$/  { print $1 " " $2 " " $3}'))
+        if [ ${DPMSARR[0]} -eq 0 ]; then
+                # Disable screensaver and DPMS Power Saving if requested
+                xset s off
+                if grep -q '\W*nodpms\W*' /proc/cmdline; then
+                        xset -dpms
+                fi
+        else
+                xset s on
+                xset s ${DPMSARR[0]}
+                if ! grep -q '\W*nodpms\W*' /proc/cmdline; then
+                        # Yes, "+dpms dpms" is intentional.
+                        xset +dpms dpms ${DPMSARR[0]} ${DPMSARR[1]} ${DPMSARR[2]}
+                fi
+        fi
+fi
+
+if grep -q '\W*blankdpmsfix\W*' /proc/cmdline; then
+	xset dpms force on 
+	xset dpms 0 0 0 
+	xset -dpms
+fi
+
+
diff --git a/config/includes.chroot/etc/X11/Xsession.d/60x11-openbox-start b/config/includes.chroot/etc/X11/Xsession.d/60x11-openbox-start
new file mode 100644
index 0000000..9835ae9
--- /dev/null
+++ b/config/includes.chroot/etc/X11/Xsession.d/60x11-openbox-start
@@ -0,0 +1,4 @@
+# Spawn openbox
+openbox &
+echo -en "\n$(date +'%F | %T | ')'$0' spawned OpenBox." | tee -a /dev/tty8
+
diff --git a/config/includes.chroot/etc/X11/Xsession.d/60x11-set-background b/config/includes.chroot/etc/X11/Xsession.d/60x11-set-background
new file mode 100644
index 0000000..bb6f052
--- /dev/null
+++ b/config/includes.chroot/etc/X11/Xsession.d/60x11-set-background
@@ -0,0 +1,43 @@
+# set screen background to X2Go default blue on all detected screens, unless color or image is specified
+XROOT=$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | awk -F '=' '$1 == "xroot" { print $2 }' | tr -dc '0-9a-zA-Z,$-_.+!*'"'"'();/?:@=&')
+XROOTMODE=$(cat /proc/cmdline | tr ' ' '\n' | awk -F'=' '"xrootmode"==$1 {print $2}')
+IMAGEDIR=/var/tmp/images/
+
+# TODO: mate-minidesktop: image is stored as /usr/share/backgrounds/x2go/x2gothinclient-minidesktop_background.svg - needs to be svg
+
+if [ -n "$XROOT" ] ; then
+	XROOTSHORT=$(echo "$XROOT" | tr -dc '0-9a-fA-Fx')
+
+	if echo "$XROOTSHORT" | grep -q '^0x' && [ 8 = ${#XROOTSHORT} ] ; then
+		# this should be a hex color string
+		HEXCOLOR=${XROOTSHORT#0x}
+		if [ 6 = ${HEXCOLOR} ] ; then
+			xsetroot -solid "#$HEXCOLOR" # set requested color
+		else
+			xsetroot -grey # show that something's amiss
+		fi
+	elif echo "$XROOT" | grep -q "://" ; then
+		# this could be an URI
+		# TODO move this download part to an earlier script
+		wget -P $IMAGEDIR/background/ "${XROOT/|/ }"
+		if [ $(ls $IMAGEDIR 2>/dev/null| wc -l) -gt 0 ] ; then
+			#input validation
+			case "${XROOTMODE,,}" in # force lowercase
+				"center") POSITION=center ;;
+				"fill") POSITION=fill ;;
+				"scale") POSITION=scale ;;
+				"tile") POSITION=tile ;;
+				*) POSITION=max ;;
+			esac
+			# POSITION: center fill max scale tile; default: max
+			feh --nofehbg --bg-$POSITION $IMAGEDIR/background/*
+		else
+			xsetroot -grey # show that something's amiss
+		fi
+	fi
+
+else
+	# set our default color
+	xsetroot -solid "#246ed8"
+fi
+
diff --git a/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-pulseaudio b/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-pulseaudio
new file mode 100644
index 0000000..157cbb6
--- /dev/null
+++ b/config/includes.chroot/etc/X11/Xsession.d/60x11-spawn-configure-pulseaudio
@@ -0,0 +1,32 @@
+# Spawn PulseAudio
+if ! ps -C pulseaudio >/dev/null ; then
+	pulseaudio -D -n -L 'module-native-protocol-tcp port=4713' -L 'module-udev-detect' --exit-idle-time=65535 &
+fi
+
+AUDIOOUT=$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline |              awk -F'=' ' /^audioout=/ { print $2 }' |              tr -dc 'a-zA-Z0-9.:_\-@|')
+
+if [ -n "$AUDIOOUT" ] ; then
+        (
+                while ! pacmd dump 2>&1| grep -q set-card-profile ; do
+                        echo -en "\n$(date +'%F | %T | ')'$0': Waiting for pulseaudio to start ..." | tee -a /dev/tty8
+                        sleep 1
+                done
+                if [ "$AUDIOOUT" = "list" ] ; then
+                        echo -en "\n$(date +'%F | %T | ')'$0': Available audio outputs:" | tee -a /dev/tty8
+                        AUDIOOUTPUTS=$( for CARD in $(pacmd list-cards | grep -A1 index | awk -F '[<> \t]' ' $2 == "name:" { print $4 }'); do
+                                                pacmd list-cards |                                              more +/"$CARD" |                                                grep -m 1 "$CARD" -A100000 |
+                more +/"profiles:" |                                            grep -m 1 -B10000 "active profile:" |                                           grep -A10000 "profiles" |                                               gre
+p "\W\Woutput:" |                                            grep -v "active profile:" |                                             awk -F'[+:]' '{gsub("\t","",$1) ; print "\"'$CARD'|" $1 ":" $2 "\""} ';
+                                        done |                                  sort -u )
+                        for AUDIOOUTPUT in $AUDIOOUTPUTS; do
+                                echo -en "\n$(date +'%F | %T | ')'$0': $AUDIOOUTPUT" | tee -a /dev/tty8
+                        done
+                        echo -en "\n$(date +'%F | %T | ')'$0': $(pacmd list | 'grep active profile')" | tee -a /dev/tty8
+                elif (echo "$AUDIOOUT" | grep -q '^[^|]*|[^|]*$') ; then
+                        $(echo "$AUDIOOUT" | sed -e 's/^/pacmd set-card-profile /' -e 's/|/ /')
+                else
+                        : # NOP
+                fi
+        ) &
+fi
+
diff --git a/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig b/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig
index 6939b68..9685d8a 100755
--- a/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig
+++ b/config/includes.chroot/lib/live/config/2900-x2go-thinclientconfig
@@ -24,13 +24,6 @@ cat >/home/user/.xsession <<XSESSION
 # http://code.x2go.org/gitweb?p=x2gothinclient.git;a=blob_plain;f=displaymanager/sbin/x2gothinclientd;h=6897d42d17bd6778e7de5e62ec3f51727d4e8800;hb=HEAD
 # check the above file for ideas before reinventing the wheel
 
-# Spawn PulseAudio
-pulseaudio -D -n -L 'module-native-protocol-tcp port=4713' -L 'module-udev-detect' --exit-idle-time=65535 &
-
-AUDIOOUT=\$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | \
-             awk -F'=' ' /^audioout=/ { print \$2 }' | \
-             tr -dc 'a-zA-Z0-9.:_\-@|')
-
 # additional variable instead of "case \$(...) in", as we need the value again later on
 XRANDRCMDTAINTED=\$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | awk -F '=' '\$1 == "xinerama" { print \$2 }')
 
@@ -86,17 +79,6 @@ for NEXT_DISPLAY in \$(LANG=C xrandr 2>/dev/null | grep ' connected ' | cut -d '
 	THIS_DISPLAY=\$NEXT_DISPLAY
 done
 
-# code to fix blank screen happening with DisplayPort and some buggy TFTs (xset q reports "Monitor is on" even though it is pitch black)
-if grep -q '\W*blankdpmsfix\W*' /proc/cmdline; then
-	xset dpms force suspend 
-fi
-
-# Spawn openbox
-openbox &
-
-# set screen background to X2Go default blue on all detected screens
-xsetroot -solid "#246ed8"
-
 # Get X2GoConfig
 BROKERURL=\$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | \
 	     awk -F'=' ' /^broker-url=/ { print \$2 }' | \
@@ -212,62 +194,6 @@ if [ -n "\$THROTTLEVALUES" ]; then
 	fi
 fi
 
-# code to fix blank screen happening with DisplayPort and some buggy TFTs (xset q reports "Monitor is on" even though it is pitch black)
-if grep -q '\W*blankdpmsfix\W*' /proc/cmdline; then
-	xset dpms force on dpms 0 0 0 -dpms
-fi
-
-BLANKINGTIME=\$(sed -e 's/ \([^ ]*\)=/\n\1=/g' -e 's/\([^=]["'"'"']\) /\1\n/g' -e 's/ \([^ "'"'"']\)/\n\1/g' /proc/cmdline | awk -F '=' '\$1 == "blank" { print \$2 }' | tr -dc '0-9:')
-if [ -n "\$BLANKINGTIME" ]; then
-	DPMSARR=(\$(echo \$BLANKINGTIME | awk -F ':' '\$1 ~/^[0-9]*\$/ && \$2 ~/^[0-9]*\$/ && \$3 ~/^[0-9]*\$/  { print \$1 " " \$2 " " \$3}'))
-	if [ \${DPMSARR[0]} -eq 0 ]; then
-		# Disable screensaver and DPMS Power Saving if requested
-		xset s off
-		if grep -q '\W*nodpms\W*' /proc/cmdline; then
-			xset -dpms
-		fi
-	else
-		xset s on
-		xset s \${DPMSARR[0]}
-		if ! grep -q '\W*nodpms\W*' /proc/cmdline; then
-			# Yes, "+dpms dpms" is intentional. 
-			xset +dpms dpms \${DPMSARR[0]} \${DPMSARR[1]} \${DPMSARR[2]}
-		fi
-	fi
-fi
-
-if [ -n "\$AUDIOOUT" ] ; then
-	(
-		while ! pacmd dump 2>&1| grep -q set-card-profile ; do
-			echo -en "\n\$(date +'%F | %T | ')'\$0': Waiting for pulseaudio to start ..." | tee -a /dev/tty8
-			sleep 1
-		done
-		if [ "\$AUDIOOUT" = "list" ] ; then
-			echo -en "\n\$(date +'%F | %T | ')'\$0': Available audio outputs:" | tee -a /dev/tty8
-			AUDIOOUTPUTS=\$(	for CARD in \$(pacmd list-cards | grep -A1 index | awk -F '[<> \t]' ' \$2 == "name:" { print \$4 }'); do 
-						pacmd list-cards | \
-						more +/"\$CARD" | \
-						grep -m 1 "\$CARD" -A100000 | \
-						more +/"profiles:" | \
-						grep -m 1 -B10000 "active profile:" | \
-						grep -A10000 "profiles" | \
-						grep "\W\Woutput:" | \
-						grep -v "active profile:" | \
-						awk -F'[+:]' '{gsub("\t","",\$1) ; print "\"'\$CARD'|" \$1 ":" \$2 "\""} ';
-					done | \
-					sort -u )
-			for AUDIOOUTPUT in \$AUDIOOUTPUTS; do
-				echo -en "\n\$(date +'%F | %T | ')'\$0': \$AUDIOOUTPUT" | tee -a /dev/tty8
-			done
-			echo -en "\n\$(date +'%F | %T | ')'\$0': \$(pacmd list | 'grep active profile')" | tee -a /dev/tty8
-		elif (echo "\$AUDIOOUT" | grep -q '^[^|]*|[^|]*\$') ; then
-			\$(echo "\$AUDIOOUT" | sed -e 's/^/pacmd set-card-profile /' -e 's/|/ /')
-		else
-			: # NOP
-		fi
-	) &
-fi
-
 eval \$THROTTLINGCOMMAND x2goclient --thinclient --no-session-edit --no-menu --maximize --add-to-known-hosts --haltbt --read-exports-from=/home/user/export \$LDAPPARAMS \$SESSIONFROM \$BACKGROUND \$BRANDING \$STARTSESSION
 XSESSION
 

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list