summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2020-02-06 14:09:01 +0100
committerJonathan Bauer2020-02-06 14:09:01 +0100
commit35fcc5af1801155b0446ed921476a2c3671cf101 (patch)
treea7c21e629ee153a042350caecaa774356bfa8923
parent[kiosk-chromium] do not reload while user acts (diff)
downloadmltk-35fcc5af1801155b0446ed921476a2c3671cf101.tar.gz
mltk-35fcc5af1801155b0446ed921476a2c3671cf101.tar.xz
mltk-35fcc5af1801155b0446ed921476a2c3671cf101.zip
[kiosk-chromium] fix auto-reload
-rw-r--r--core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium26
-rw-r--r--core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-preload10
2 files changed, 25 insertions, 11 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 bdbd275e..91127373 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
@@ -99,13 +99,27 @@ fi
if [ -n "$SLX_BROWSER_RELOAD_SECS" ]; then
(
+ wid=
+ wpid=
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
+ if [ -z "$wid" ]; then
+ wid="$(xdotool search --onlyvisible --class browser)"
+ [ -z "$wid" ] && sleep 1 && continue
+ readonly wid
+ fi
+ if [ -z "$wpid" ]; then
+ wpid="$(xprop -id "$wid" | awk -F= '$1 ~ /_NET_WM_PID\(CARDINAL\)/ {print $2}' | tr -d ' ')"
+ if [ -z "$wpid" ]; then
+ # logs to ~/.xsession-errors
+ echo "Failed to get the pid of chromium-browser via xprop..."
+ exit 1
+ fi
+ readonly wpid
+ fi
+ if [ ! -d "/proc/$wpid" ]; then
+ echo "Process with PID $wpid stopped, exiting auto-reload loop."
+ exit 0
+ fi
current_idle="$(idle-daemon --send 'get :0' | grep -oP '(?<=idleSeconds=)[0-9]+')"
if [ "$current_idle " -ge "$SLX_BROWSER_RELOAD_SECS" ]; then
xdotool windowactivate "$wid"
diff --git a/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-preload b/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-preload
index 285acc86..29542d22 100644
--- a/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-preload
+++ b/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-preload
@@ -1,13 +1,13 @@
#!/bin/ash
#
# Simple "preload" by just reading the directory /usr/lib/chromium-browser
-
-preload() {
- find /usr/lib/chromium-browser -type f -exec dd if={} of=/dev/null \; &
-}
+# Tested the variation loading just the linked libraries, but it does
+# not bring the same startup acceleration than this trivial method...
. /opt/openslx/config
if [ "${SLX_BROWSER//chromium/}" != "$SLX_BROWSER" ]; then
- preload &
+ (
+ find /usr/lib/chromium-browser -type f -exec dd if={} of=/dev/null \; &> /dev/null &
+ ) &
fi