summaryrefslogtreecommitdiffstats
path: root/core/modules/idleaction
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-18 14:38:45 +0100
committerSimon Rettberg2019-11-18 14:38:45 +0100
commit86bcc19a854336829b9c4467c9ec4c94d216a0c0 (patch)
tree2a799714f0b3892424967a46e807ff56e7684863 /core/modules/idleaction
parentRevert "[pvs2] Disable idle-daemon saver/dpms for dedicated manager" (diff)
downloadmltk-86bcc19a854336829b9c4467c9ec4c94d216a0c0.tar.gz
mltk-86bcc19a854336829b9c4467c9ec4c94d216a0c0.tar.xz
mltk-86bcc19a854336829b9c4467c9ec4c94d216a0c0.zip
[xscreensaver/idleaction] Let xscreensaver manage standby again...
Diffstat (limited to 'core/modules/idleaction')
-rwxr-xr-xcore/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver48
-rwxr-xr-xcore/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher7
2 files changed, 46 insertions, 9 deletions
diff --git a/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver b/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
index 6e4d93f8..8a203f9f 100755
--- a/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
+++ b/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
@@ -1,6 +1,7 @@
#!/bin/ash
if which xscreensaver; then
+ DPMS=False
AUTOLOCK=True
secsToTime() {
local NUM SECS MINS HRS
@@ -8,13 +9,40 @@ if which xscreensaver; then
SECS=0$(( NUM % 60 ))
MINS=0$(( ( NUM / 60 ) % 60 ))
HRS=0$(( ( NUM / 3600 ) % 60 ))
- echo "${HRS:$(( ${#HRS} - 2 )):2}:${MINS:$(( ${#MINS} - 2 )):2}:${SECS:$(( ${#SECS} - 2 )):2}"
+ printf "%02d:%02d:%02d" "$HRS" "$MINS" "$SECS"
}
[ -z "$UID" ] && UID=$(id -u)
[ -z "$HOME" ] && HOME="$(getent passwd "$UID" | head -n 1 | awk -F ':' '{print $6}')"
. /opt/openslx/config
- if [ -n "${SLX_EXAM}" ]; then
+ SBY="${SLX_SCREEN_STANDBY_TIMEOUT}"
+ SVR="${SLX_SCREEN_SAVER_TIMEOUT}"
+ if [ -n "${SLX_EXAM}" ] || [ -e "$HOME/.no-saver" ]; then
SLX_SCREEN_SAVER_GRACE_TIME=
+ AUTOLOCK=False
+ SBY=0
+ SVR=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
+ # Create config value for standby timeout
+ if [ "$SBY" -gt 0 ]; then
+ DPMS=True
+ STANDBY="$( secsToTime "$SBY" )"
+ else
+ STANDBY="99:00:00"
+ fi
+ # Explicit screen saver timeout set
+ if [ "$SVR" -gt 0 ] && [ "$SVR" -lt 60 ]; then
+ SVR=60
+ fi
+ if [ "$SVR" -gt 0 ]; then
+ TIMEOUT="$( secsToTime "$SVR" )"
+ else
+ TIMEOUT="99:00:00"
fi
if [ -z "$SLX_SCREEN_SAVER_GRACE_TIME" ]; then
GRACE="99:00:00"
@@ -22,23 +50,31 @@ if which xscreensaver; then
else
GRACE="$( secsToTime "$SLX_SCREEN_SAVER_GRACE_TIME" )"
fi
- if ! [ -s "$HOME/.xscreensaver" ]; then
- cat > "$HOME/.xscreensaver" <<EOF
+ # Always overwrite this file -- better for exam mode, or if .no-saver changed
+ cat > "$HOME/.xscreensaver" <<EOF
+# Automatically generated on $(date) -- modifications might get lost
mode: one
cycle: 99:00:00
-timeout: 99:00:00
+timeout: $TIMEOUT
lock: $AUTOLOCK
lockTimeout: $GRACE
fade: False
unfade: False
+dpmsEnabled: $DPMS
+dpmsStandby: $STANDBY
+dpmsSuspend: $STANDBY
+dpmsOff: $STANDBY
dpmsFullThrottle: True
newLoginCommand:
externalUngrabCommand: /opt/openslx/xscreensaver/ungrab
programs: /opt/openslx/bin/bwlp-screensaver
selected: 0
EOF
- fi
+ (
+ # HACK: This prevents xscreensaver from ever locking
+ [ -n "$SLX_EXAM" ] && export RUNNING_UNDER_GDM="not really but yea"
xscreensaver -no-splash &
+ )
fi
true
diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher b/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher
index 24b52679..98168436 100755
--- a/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher
+++ b/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher
@@ -11,9 +11,10 @@ if [ -z "${SLX_EXAM}" ]; then
[ -n "$SLX_LOGOUT_TIMEOUT" ] && CMD="$CMD --logout-timeout $SLX_LOGOUT_TIMEOUT"
[ -n "$SLX_SYSTEM_STANDBY_TIMEOUT" ] && CMD="$CMD --suspend-timeout $SLX_SYSTEM_STANDBY_TIMEOUT"
- [ -n "$SLX_SCREEN_SAVER_TIMEOUT" ] && CMD="$CMD --screensaver-timeout $SLX_SCREEN_SAVER_TIMEOUT"
- [ -n "$SLX_SCREEN_STANDBY_TIMEOUT" ] && CMD="$CMD --dpms-timeout $SLX_SCREEN_STANDBY_TIMEOUT"
- [ -n "$SLX_SCREEN_SAVER_GRACE_TIME" ] && CMD="$CMD --grace-period $SLX_SCREEN_SAVER_GRACE_TIME"
+ # Taken care of by xscreensaver again, as it can now account for ungrab hook messups.
+ #[ -n "$SLX_SCREEN_SAVER_TIMEOUT" ] && CMD="$CMD --screensaver-timeout $SLX_SCREEN_SAVER_TIMEOUT"
+ #[ -n "$SLX_SCREEN_STANDBY_TIMEOUT" ] && CMD="$CMD --dpms-timeout $SLX_SCREEN_STANDBY_TIMEOUT"
+ #[ -n "$SLX_SCREEN_SAVER_GRACE_TIME" ] && CMD="$CMD --grace-period $SLX_SCREEN_SAVER_GRACE_TIME"
else
# Exam mode active
CMD="$CMD --min-idle 7200" # Ignore schedule if idle time is lower than 2h