From 0155b861cbccdd62093c15626490a11a98067ead Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 5 Feb 2020 16:58:02 +0100 Subject: [kiosk-chromium] do not reload while user acts --- .../opt/openslx/scripts/kiosk-launch.d/00-chromium | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium index 9ee4ca19..bdbd275e 100644 --- a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium +++ b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium @@ -95,13 +95,26 @@ if [ -z "$SLX_BROWSER_INTERACTIVE" ]; then # xbinkeys requires a daemon, run it xbindkeys_autostart & - if [ -n "$SLX_BROWSER_RELOAD_SECS" ]; then - while true; do - xdotool windowactivate "$(xdotool search --onlyvisible --class browser)" +fi + +if [ -n "$SLX_BROWSER_RELOAD_SECS" ]; then + ( + while true; do + wid="$(xdotool search --onlyvisible --class browser)" + [ -z "$wid" ] && sleep 1 && continue + readonly wid + wpid="$(xprop -id "$wid" | awk -F= '$1 ~ /_NET_WM_PID\(CARDINAL\)/ {print $2}' | tr -d ' ')" + readonly wpid + [ ! -d "/proc/$wpid" ] && exit 0 + current_idle="$(idle-daemon --send 'get :0' | grep -oP '(?<=idleSeconds=)[0-9]+')" + if [ "$current_idle " -ge "$SLX_BROWSER_RELOAD_SECS" ]; then + xdotool windowactivate "$wid" xdotool key Alt+Home - sleep "$SLX_BROWSER_RELOAD_SECS" - done & - fi + continue + fi + sleep "$(( SLX_BROWSER_RELOAD_SECS - current_idle ))" + done + ) & fi if [ -n "$SLX_BROWSER_INSECURE" ]; then -- cgit v1.2.3-55-g7522