blob: d98bc9819209a75b1adeec24e7fd8ab6467f2f68 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#!/bin/bash
# generic kiosk mode launcher
. /opt/openslx/config
export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin"
[ -z "$SLX_BROWSER_URL" ] && exit 1
. /opt/openslx/bin/slx-tools
# disable power management features
xset s off
xset -dpms
# start openbox window manager
openbox --config-file "/etc/xdg/openbox/rc.xml.kiosk" &
# move the mouse away
xdotool mousemove 20000 20000
if [ -z "$SLX_BROWSER_INTERACTIVE" ]; then
# swallow keyboard shortcuts of chromium
xbindkeys -f /opt/openslx/lightdm/xbindkeys-kiosk.rc &
else
# volume controls only
xbindkeys -f /opt/openslx/lightdm/xbindkeys-kiosk-interactive.rc &
fi
# Remember list of jobs running the background, so we can clean up
# any mess left around by failed attempts below
#
#### Don't fork anything into background after this point
# Convert \n to spaces using echo
declare -rg BASE_JOBS="$( echo $(jobs -p) )"
kill_jobs() {
local j
for j in $(jobs -p); do
# Was already running before? Skip
[[ " $BASE_JOBS " == *" $j "* ]] && continue
kill "$j"
done
}
# try specific browser first, if any
for browser in $SLX_BROWSER; do
[[ "$browser" =~ ^[a-zA-Z0-9_.\-]+$ ]] || continue
for file in "$0".d/*"$browser"*; do
[ -f "$file" ] || continue
. "$file" || slxlog "kiosk-launch" "Failed to source '$file'."
kill_jobs
done
done
# still here...
# try anything
for file in "$0".d/*; do
[ -f "$file" ] || continue
. "$file" || slxlog "kiosk-launch" "Failed to source '$file'."
kill_jobs
done
# should not come to this point as above sources should
# exec away
slxlog --sync "kiosk-launch" "No kiosk browser configured/available!"
exit 1
|