summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/modules/idleaction/data/etc/cron.d/openslx-idleaction2
-rwxr-xr-xcore/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script20
-rwxr-xr-xcore/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware28
-rwxr-xr-xcore/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver1
-rwxr-xr-xcore/modules/xscreensaver/data/opt/openslx/xscreensaver/ungrab10
5 files changed, 58 insertions, 3 deletions
diff --git a/core/modules/idleaction/data/etc/cron.d/openslx-idleaction b/core/modules/idleaction/data/etc/cron.d/openslx-idleaction
index 9669add9..a7f342a0 100644
--- a/core/modules/idleaction/data/etc/cron.d/openslx-idleaction
+++ b/core/modules/idleaction/data/etc/cron.d/openslx-idleaction
@@ -3,5 +3,5 @@
SHELL=/bin/ash
PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin
-*/2 * * * * root /opt/openslx/scripts/idleaction-cron_script
+* * * * * root /opt/openslx/scripts/idleaction-cron_script
diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
index f40ffa34..78e0212b 100755
--- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
+++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
@@ -92,6 +92,10 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then
if [ -z "$LOCK" ] || [ "$(( OLDLOCKTIME - LOCK ))" -gt 120 ] || [ "$(( LOCK - OLDLOCKTIME ))" -gt 120 ]; then
# Not locked anymore, or lock time has changed (= unlock and relock), nuke old value
sed -i '/^lockIdleTime=/d;/^lockTime=/d' "$RUNFILE"
+ if [ -n "$LOCK" ]; then
+ TIMEOUT=$(( LOCK + SLX_LOGOUT_TIMEOUT ))
+ sed -i "s/^lockDeadline=.*\$/lockDeadline=$TIMEOUT/" "$RUNFILE"
+ fi
fi
if [ -n "$LOCK" ]; then
# Screen is locked, ignore further idle time updates
@@ -113,7 +117,20 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then
IDLE="$LOCK"
fi
if [ -n "$IDLE" ] && [ "$IDLE" -gt 0 ]; then
- TIMEOUT=$(( IDLE + SLX_LOGOUT_TIMEOUT ))
+ if [ -z "$LOCK" ] || grep -Fxq 'lockDeadline=0' "$RUNFILE"; then
+ # Only update if screen is unlocked, or no deadline was recorded yet
+ TIMEOUT=$(( IDLE + SLX_LOGOUT_TIMEOUT ))
+ sed -i "s/^lockDeadline=.*\$/lockDeadline=$TIMEOUT/" "$RUNFILE"
+ else
+ # Use stored value
+ RET=$(awk -F= '{if ($1 == "lockDeadline") { print $2; exit } }' "$RUNFILE")
+ if [ -n "$RET" ]; then
+ TIMEOUT="$RET"
+ else
+ TIMEOUT=$(( IDLE + SLX_LOGOUT_TIMEOUT ))
+ echo "lockDeadline=$TIMEOUT" >> "$RUNFILE"
+ fi
+ fi
if [ "$TIMEOUT" -lt "$NOW" ]; then
rm -f -- "$RUNFILE"
@@ -121,7 +138,6 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then
loginctl terminate-session "$ses"
else
IS_IDLE=no
- sed -i "s/^lockDeadline=.*$/lockDeadline=$TIMEOUT/" "$RUNFILE"
fi
else
# xprint* did not work?
diff --git a/core/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware b/core/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware
new file mode 100755
index 00000000..a71774d3
--- /dev/null
+++ b/core/modules/vmware12/data/opt/openslx/xscreensaver/ungrab.d/vmware
@@ -0,0 +1,28 @@
+#!/bin/ash
+
+wfile="/run/user/$(id -u)/vmwins"
+
+if [ "$1" = "pre" ]; then
+ # Find all vmware windows currently visible
+ WINDOWS=$(xdotool search --onlyvisible --class vmplayer)
+ for window in $WINDOWS; do
+ xdotool windowminimize $window
+ echo "$window" >> "$wfile" # Remember for later
+ done
+ # move mouse pointer around to avoid some problems with ghost clicks
+ # also this resets the idle time durr hurr
+ xdotool mousemove 0 0
+ usleep 10000
+ xdotool mousemove --polar 0 0
+ usleep 10000
+fi
+
+if [ "$1" = "post" ]; then
+ # let's restore vmware
+ WINDOWS=$(sort -u "$wfile")
+ for window in $WINDOWS; do
+ xdotool windowmap $window
+ done
+fi
+
+exit 0
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 69b9fa51..cd28bdb8 100755
--- a/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver
+++ b/core/modules/xscreensaver/data/etc/X11/Xsession.d/95-xscreensaver
@@ -68,6 +68,7 @@ dpmsStandby: $STANDBY
dpmsSuspend: $STANDBY
dpmsOff: $STANDBY
newLoginCommand:
+externalUngrabCommand: /opt/openslx/xscreensaver/ungrab
programs: /opt/openslx/bin/bwlp-screensaver
selected: 0
EOF
diff --git a/core/modules/xscreensaver/data/opt/openslx/xscreensaver/ungrab b/core/modules/xscreensaver/data/opt/openslx/xscreensaver/ungrab
new file mode 100755
index 00000000..1c355be8
--- /dev/null
+++ b/core/modules/xscreensaver/data/opt/openslx/xscreensaver/ungrab
@@ -0,0 +1,10 @@
+#!/bin/ash
+
+for file in /opt/openslx/xscreensaver/ungrab.d/*; do
+ [ -f "$file" ] || continue
+ [ -x "$file" ] || continue
+ "$file" "$@"
+done
+
+exit 0
+