summaryrefslogtreecommitdiffstats
path: root/core/modules/idleaction
diff options
context:
space:
mode:
authorSimon Rettberg2019-05-14 15:48:44 +0200
committerSimon Rettberg2019-05-14 15:48:44 +0200
commitd8acc57f354a93929573393850c61e01c2f8d103 (patch)
treebe40e0be4037a5993cf95a46ab4145b44b138b10 /core/modules/idleaction
parent[idleaction] Refine exam mode shutdown/reboot timing (diff)
downloadmltk-d8acc57f354a93929573393850c61e01c2f8d103.tar.gz
mltk-d8acc57f354a93929573393850c61e01c2f8d103.tar.xz
mltk-d8acc57f354a93929573393850c61e01c2f8d103.zip
[xscreensaver/idleaction] DPMS handled by idle-daemon
Diffstat (limited to 'core/modules/idleaction')
-rw-r--r--core/modules/idleaction/data/etc/X11/Xsession.d/50-set_session_dpms18
-rwxr-xr-xcore/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver45
-rw-r--r--core/modules/idleaction/data/etc/X11/Xsetup.d/50-set_lightdm_dpms (renamed from core/modules/idleaction/data/etc/X11/Xsession.d/50-set_lightdm_dpms)0
3 files changed, 63 insertions, 0 deletions
diff --git a/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_session_dpms b/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_session_dpms
new file mode 100644
index 00000000..3459a503
--- /dev/null
+++ b/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_session_dpms
@@ -0,0 +1,18 @@
+#!/bin/ash sourced
+
+# Set DPMS values in Xsession. This will apply for user sessions
+
+if [ -z "$SLX_PXE_SERVER_IP" ] && [ -z "$SLX_SCREEN_STANDBY_TIMEOUT" ]; then
+ . /opt/openslx/config # Not sourced yet
+fi
+
+xset s off
+if [ -n "$SLX_SCREEN_STANDBY_TIMEOUT" ]; then
+ xset dpms 0 0 0 &> /dev/null
+ xset +dpms &> /dev/null
+else
+ xset -dpms &> /dev/null
+fi
+
+:
+
diff --git a/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver b/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
new file mode 100755
index 00000000..6e4d93f8
--- /dev/null
+++ b/core/modules/idleaction/data/etc/X11/Xsession.d/95-xscreensaver
@@ -0,0 +1,45 @@
+#!/bin/ash
+
+if which xscreensaver; then
+ AUTOLOCK=True
+ secsToTime() {
+ local NUM SECS MINS HRS
+ NUM="$1"
+ 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}"
+ }
+ [ -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
+ SLX_SCREEN_SAVER_GRACE_TIME=
+ fi
+ if [ -z "$SLX_SCREEN_SAVER_GRACE_TIME" ]; then
+ GRACE="99:00:00"
+ AUTOLOCK=False
+ else
+ GRACE="$( secsToTime "$SLX_SCREEN_SAVER_GRACE_TIME" )"
+ fi
+ if ! [ -s "$HOME/.xscreensaver" ]; then
+ cat > "$HOME/.xscreensaver" <<EOF
+mode: one
+cycle: 99:00:00
+timeout: 99:00:00
+lock: $AUTOLOCK
+lockTimeout: $GRACE
+fade: False
+unfade: False
+dpmsFullThrottle: True
+newLoginCommand:
+externalUngrabCommand: /opt/openslx/xscreensaver/ungrab
+programs: /opt/openslx/bin/bwlp-screensaver
+selected: 0
+EOF
+ fi
+ xscreensaver -no-splash &
+fi
+
+true
+
diff --git a/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_lightdm_dpms b/core/modules/idleaction/data/etc/X11/Xsetup.d/50-set_lightdm_dpms
index c036e22a..c036e22a 100644
--- a/core/modules/idleaction/data/etc/X11/Xsession.d/50-set_lightdm_dpms
+++ b/core/modules/idleaction/data/etc/X11/Xsetup.d/50-set_lightdm_dpms