Skip to content

Commit

Permalink
Use kiosk-browser-control interactive to open an interactive
Browse files Browse the repository at this point in the history
Shell within a running kiosk-browser session.

Chromium on Raspbian does not support --start-fullscreen so we try
to use --app instead and instrument openbox to maximize the window.

openbox needs to be killed with -9 (at leat on Raspbian), try to catch
the case where a sleep 313 is left over (maybe because a new sleep 313
starts just when we terminate).
  • Loading branch information
schlomo committed Feb 12, 2015
1 parent f5f8e4b commit a511d47
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: kiosk-browser
Version: 46
Version: 47
Priority: optional
Section: web
Architecture: all
Expand Down
21 changes: 18 additions & 3 deletions src/usr/bin/kiosk-browser-control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

function usage {
echo "Usage: $0 <start|stop|status|restart|evening|morning>"
echo "Usage: $0 <start|stop|status|restart|evening|morning|interactive>"
exit 1
}

Expand Down Expand Up @@ -34,7 +34,7 @@ function status {
if pstree -paul kiosk-browser 2>/dev/null ; then
return 0
else
echo "kiosk-browser not running"
echo "kiosk-browser not running" 1>&2
return 1
fi
}
Expand All @@ -44,6 +44,21 @@ function restart {
sleep 10
start
}

function interactive {
status >/dev/null || return 1

homedir=( /tmp/kiosk-browser.HOME* )
if [[ "$homedir" != "${homedir[*]}" ]] ; then
echo "ERROR: Found more than one kiosk-browser Home Directory: ${homedir[*]}" 1>&2
echo " Please clean up the stale directories and try again" 1>&2
return 1
fi

echo "Launching interactive Shell in current kiosk-browser session."
sudo -u kiosk-browser -i env HOME=$homedir DISPLAY=:0 bash -i
}

function evening {
stop
is_pi && tvservice -o || vbetool dpms off
Expand All @@ -59,7 +74,7 @@ function morning {


case "$1" in
(start|stop|status|restart) "$1" ;;
(start|stop|status|restart|interactive) "$1" ;;
(evening|morning) [[ -e /tmp/kiosk-browser-disable-morning-evening ]] || "$1" ;;
(*) usage ;;
esac
5 changes: 5 additions & 0 deletions src/usr/share/kiosk-browser/openbox-rc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ openbox configuration for kiosk-browser
<skip_pager>yes</skip_pager>
<skip_taskbar>yes</skip_taskbar>
</application>

<application class="Chromium">
<decor>no</decor>
<maximized>true</maximized>
</application>
</applications>

</openbox_config>
8 changes: 4 additions & 4 deletions src/usr/share/kiosk-browser/xsession.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
exec &> >(logger -t kiosk-browser)

KILL_ON_EXIT=
HOME=$(mktemp -d)
HOME=$( mktemp -d -t kiosk-browser.HOME.XXXXXXXXXXXXX )
function exittrap {
kill $KILL_ON_EXIT $(jobs -p)
kill -9 $KILL_ON_EXIT $(jobs -p)
sleep 2
rm -Rf $HOME
}
Expand Down Expand Up @@ -90,7 +90,7 @@ xset s noblank
# start watchdog, reboot system if screen stops to change
if (( KIOSK_BROWSER_WATCHDOG_TIMEOUT > 0 )) ; then
(
trap 'kill $(jobs -p)' TERM
trap 'kill $(jobs -p) ; sleep 1 ; kill $(jobs -p) &>/dev/null' TERM

LASTHASH=""
LASTCHANGED="$SECONDS"
Expand Down Expand Up @@ -158,7 +158,7 @@ while true; do
wait $!
xdotool search --class uzbl-$c windowmove --sync $port_x 0
else
$CHROME --user-data-dir=$BROWSER_PROFILE_DIR "${KIOSK_BROWSER_OPTIONS[@]}" --disable-translate --no-first-run --start-fullscreen "$URL" &
$CHROME --user-data-dir=$BROWSER_PROFILE_DIR "${KIOSK_BROWSER_OPTIONS[@]}" --disable-translate --no-first-run --start-fullscreen --app="$URL" &

# move new window to the current screen. We identify the window by the --user-data-dir option which appears in the window class name :-)

Expand Down

0 comments on commit a511d47

Please sign in to comment.