summaryrefslogtreecommitdiffstats
path: root/remote/modules/screen-standby/data/opt/openslx/scripts
diff options
context:
space:
mode:
authorSimon Rettberg2016-08-05 16:58:00 +0200
committerSimon Rettberg2016-08-05 16:58:00 +0200
commit6bc277f9381de34e162ddc72388a96b6b5498ae4 (patch)
tree0fe3843cefdba3ff1e824d33b0609debbdd6230d /remote/modules/screen-standby/data/opt/openslx/scripts
parent[vmchooser2] Honor new autostart param/variable (diff)
downloadtm-scripts-6bc277f9381de34e162ddc72388a96b6b5498ae4.tar.gz
tm-scripts-6bc277f9381de34e162ddc72388a96b6b5498ae4.tar.xz
tm-scripts-6bc277f9381de34e162ddc72388a96b6b5498ae4.zip
[screen-standby] New module for managing screen standby settings
Diffstat (limited to 'remote/modules/screen-standby/data/opt/openslx/scripts')
-rw-r--r--remote/modules/screen-standby/data/opt/openslx/scripts/screen-standby29
1 files changed, 29 insertions, 0 deletions
diff --git a/remote/modules/screen-standby/data/opt/openslx/scripts/screen-standby b/remote/modules/screen-standby/data/opt/openslx/scripts/screen-standby
new file mode 100644
index 00000000..74a09556
--- /dev/null
+++ b/remote/modules/screen-standby/data/opt/openslx/scripts/screen-standby
@@ -0,0 +1,29 @@
+#!/bin/ash
+
+# This is usually sourced by Xstartup/session/reset
+
+do_standby_stuff () {
+ . /opt/openslx/config
+ # Make sure SLX_SCREEN_STANDBY_TIMEOUT is numeric
+ TO=${SLX_SCREEN_STANDBY_TIMEOUT}
+ [ -z "${TO}" ] && TO=0
+ [ "${TO}" -gt 0 ] || [ "${TO}" -lt 100 ] || TO=600
+ [ "${TO}" -lt 0 ] && TO=0
+ MIN=$(( TO / 60 ))
+ [ "$MIN" -gt 60 ] && MIN=60
+ # Set
+ setterm -blank "$MIN"
+ setterm -powerdown "$MIN"
+ if [ "${TO}" = 0 ]; then
+ # Off
+ xset s "${TO}" "${TO}"
+ xset s off -dpms
+ else
+ xset +dpms
+ xset s "${TO}" "${TO}"
+ fi
+}
+
+do_standby_stuff &
+true
+