From 60f365e413be60cd7d7a616c62200c33361e43f8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 11 Oct 2018 15:07:41 +0200 Subject: [xscreensaver] Build bwlp-screensaver --- .../data/etc/X11/Xsession.d/95-xscreensaver | 73 +++++++++++++++++----- core/modules/xscreensaver/module.build | 9 ++- core/modules/xscreensaver/module.conf | 6 ++ 3 files changed, 73 insertions(+), 15 deletions(-) (limited to 'core/modules/xscreensaver') diff --git a/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver b/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver index 469e090a..d8bd831a 100755 --- a/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver +++ b/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver @@ -1,34 +1,79 @@ #!/bin/ash +DPMS=False if which xscreensaver; then [ -z "$UID" ] && UID=$(id -u) [ -z "$HOME" ] && HOME="$(getent passwd "$UID" | head -n 1 | awk -F ':' '{print $6}')" - if ! [ -s "$HOME/.xscreensaver" ]; then - . /opt/openslx/config - NUM=${SLX_SCREEN_STANDBY_TIMEOUT} - [ -n "${SLX_EXAM}" ] && NUM=0 - if [ -n "$NUM" ] && [ "$NUM" -gt 60 ]; then - SECS=0$(( NUM % 60 )) - MINS=0$(( ( NUM / 60 ) % 60 )) - HRS=0$(( ( NUM / 3600 ) % 60 )) - STANDBY="${HRS:$(( ${#HRS} - 2 )):2}:${MINS:$(( ${#MINS} - 2 )):2}:${SECS:$(( ${#SECS} - 2 )):2}" - else - STANDBY=0:00:00 + . /opt/openslx/config + SBY=${SLX_SCREEN_STANDBY_TIMEOUT} + if [ -n "${SLX_EXAM}" ]; then + SLX_LOGOUT_TIMEOUT=0 + SBY=0 + elif [ -z "$SBY" ]; then + SBY=0 + elif [ "$SBY" -gt 0 ] && [ "$SBY" -lt 60 ]; then + SBY=60 + elif ! [ "$SBY" -ge 0 ]; then # isNumeric? + SBY=0 + fi + # Make sure standby timeout is less than logout timeout, otherwise, disable standby + if [ "$SBY" -gt 0 ]; then + if [ "$SLX_LOGOUT_TIMEOUT" -gt 0 ]; then + if [ "$SBY" -lt 300 ]; then + SBY=300 + fi + if [ "$SLX_LOGOUT_TIMEOUT" -lt "$SBY" ]; then + SBY=0 + fi fi + fi + # Create config value for standby timeout + [ "$NUM" -gt 0 ] && DPMS=True + NUM=$SBY + SECS=0$(( NUM % 60 )) + MINS=0$(( ( NUM / 60 ) % 60 )) + HRS=0$(( ( NUM / 3600 ) % 60 )) + STANDBY="${HRS:$(( ${#HRS} - 2 )):2}:${MINS:$(( ${#MINS} - 2 )):2}:${SECS:$(( ${#SECS} - 2 )):2}" + # Create config for screensaver activation timeout + if [ "$SLX_LOGOUT_TIMEOUT" -gt 0 ] && [ "$SBY" -eq 0 ]; then + # Standby is disabled, consider logout timeout + TMO=$SLX_LOGOUT_TIMEOUT + else + # Consider standby timeout + TMO=$SBY + fi + # Start screen saver 3 minutes before forced logout, or screen enters standby + TMO=$(( TMO - 180 )) + if [ "$TMO" -gt 0 ]; then + [ "$TMO" -gt 1200 ] && TMO=$(( TMO - 300 )) + NUM=$TMO + SECS=0$(( NUM % 60 )) + MINS=0$(( ( NUM / 60 ) % 60 )) + HRS=0$(( ( NUM / 3600 ) % 60 )) + TIMEOUT="${HRS:$(( ${#HRS} - 2 )):2}:${MINS:$(( ${#MINS} - 2 )):2}:${SECS:$(( ${#SECS} - 2 )):2}" + else + TIMEOUT="99:00:00" + fi + if ! [ -s "$HOME/.xscreensaver" ]; then cat > "$HOME/.xscreensaver" < "$COPYLIST" tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}" diff --git a/core/modules/xscreensaver/module.conf b/core/modules/xscreensaver/module.conf index e4d90404..defefddf 100644 --- a/core/modules/xscreensaver/module.conf +++ b/core/modules/xscreensaver/module.conf @@ -1,7 +1,13 @@ #!/bin/bash +REQUIRED_MODULES=" + qt5core +" +REQUIRED_GIT="git://git.openslx.org/openslx-ng/bwlp-screensaver.git" +REQUIRED_PREFIX="/opt/openslx/bin" REQUIRED_BINARIES=" xscreensaver xscreensaver-command + bwlp-screensaver " REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES=" -- cgit v1.2.3-55-g7522