summaryrefslogtreecommitdiffstats
path: root/core/modules/idleaction
diff options
context:
space:
mode:
authorSimon Rettberg2018-10-17 14:11:18 +0200
committerSimon Rettberg2018-10-17 14:11:18 +0200
commitd7e8f410699cac30a27eca25b3c8f67e3888fe22 (patch)
tree448ea2b98ce961b26c70c6f7fefd976f27cd5a1e /core/modules/idleaction
parent[xscreensaver/vmware12] Support ungrab hooks, work around idletime reset (diff)
downloadmltk-d7e8f410699cac30a27eca25b3c8f67e3888fe22.tar.gz
mltk-d7e8f410699cac30a27eca25b3c8f67e3888fe22.tar.xz
mltk-d7e8f410699cac30a27eca25b3c8f67e3888fe22.zip
[idlescript] Insanity ensues, slowly
Diffstat (limited to 'core/modules/idleaction')
-rwxr-xr-xcore/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script12
1 files changed, 6 insertions, 6 deletions
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 78e0212b..4741837a 100755
--- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
+++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
@@ -69,18 +69,18 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then
IDLE=
LOCK=
export XAUTHORITY=$(ps a | grep " $DISPLAY " | grep -o -- '-auth.*$' | grep -m1 -v grep | awk '{print $2}')
- [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ] && LOCK=$(xprintlocktime)
+ [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle)
# Now that we have DISPLAY and XAUTHORITY set, xprintidle should work
- if [ -z "$LOCK" ]; then
+ if [ -z "$IDLE" ]; then
# Try user's xauth
USERID=$(id -u "$NAME")
[ -z "$USERID" ] && USERID="$NAME"
USRHOME=$(/usr/bin/getent passwd "$USERID" | awk -F ':' '{print $6}')
export XAUTHORITY="$USRHOME/.Xauthority"
fi
- if [ -f "$XAUTHORITY" ]; then
- [ -z "$LOCK" ] && LOCK=$(xprintlocktime)
- IDLE=$(xprintidle)
+ if [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ]; then
+ LOCK=$(xprintlocktime)
+ [ -z "$IDLE" ] && IDLE=$(xprintidle)
[ -n "$IDLE" ] && IDLE=$(( NOW - ( IDLE / 1000 ) ))
fi
# Now consider locking - if the screen is locked, we don't want to consider the current idle time, but
@@ -92,7 +92,7 @@ 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
+ if [ -n "$LOCK" ] && [ "$OLDLOCKTIME" -gt 0 ]; then
TIMEOUT=$(( LOCK + SLX_LOGOUT_TIMEOUT ))
sed -i "s/^lockDeadline=.*\$/lockDeadline=$TIMEOUT/" "$RUNFILE"
fi