Give the kiosk a window manager, and a debug mode to go with it
The role ran no window manager on the theory that Firefox is the only X client and --kiosk makes it full-screen by itself. It doesn't: --kiosk *asks* to be full-screen over EWMH, and with no WM running nobody answers. Firefox kept its default window size in the top-left corner - on musicdolphin's 1920x1080 monitor, a 1280x972 window with black bands down the right edge and along the bottom, which looks exactly like an overscan problem and isn't one. Openbox answers the request and does nothing else. pi_kiosk_mode=debug then turns the attached screen into something workable: Firefox as an ordinary window that is not relaunched when you close it, a visible pointer, Openbox as the session leader with a root menu offering a terminal, and xterm, x11-utils and mesa-utils installed. musicdolphin is set to debug for now. The templates notify the getty handler, so a mode switch restarts the session on its own - Xorg lives in that unit's cgroup. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,12 @@
|
||||
# this account autologs into - not meant for interactive use.
|
||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
|
||||
while true; do
|
||||
{% if pi_kiosk_mode == 'debug' %}
|
||||
# No -nocursor: debugging on the device's own screen needs a pointer.
|
||||
startx
|
||||
{% else %}
|
||||
startx -- -nocursor
|
||||
{% endif %}
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
||||
32
roles/pi_kiosk/templates/openbox-menu.xml.j2
Normal file
32
roles/pi_kiosk/templates/openbox-menu.xml.j2
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Managed by ansible (pi_kiosk role). Replaces Debian's default Openbox menu, which
|
||||
points at a desktop's worth of applications that are not installed here. Right-click
|
||||
the desktop to open it; in kiosk mode there is no pointer to do that with, which is
|
||||
the point.
|
||||
-->
|
||||
<openbox_menu xmlns="http://openbox.org/3.4/menu">
|
||||
<menu id="root-menu" label="{{ inventory_hostname }}">
|
||||
<item label="Terminal">
|
||||
<action name="Execute"><command>x-terminal-emulator</command></action>
|
||||
</item>
|
||||
<separator/>
|
||||
<item label="Open the MusicMouse page">
|
||||
<action name="Execute">
|
||||
<command>firefox {{ pi_kiosk_url }}</command>
|
||||
</action>
|
||||
</item>
|
||||
<item label="Open it full-screen (kiosk)">
|
||||
<action name="Execute">
|
||||
<command>firefox --kiosk {{ pi_kiosk_url }}</command>
|
||||
</action>
|
||||
</item>
|
||||
<separator/>
|
||||
<item label="Restart Openbox">
|
||||
<action name="Restart"/>
|
||||
</item>
|
||||
<item label="End this X session (it restarts)">
|
||||
<action name="Exit"/>
|
||||
</item>
|
||||
</menu>
|
||||
</openbox_menu>
|
||||
@@ -1,15 +1,34 @@
|
||||
#!/bin/sh
|
||||
# Managed by ansible (pi_kiosk role). No window manager on purpose - Firefox is the
|
||||
# only X client, launched full-screen in kiosk mode; the loop is what takes the place
|
||||
# of a WM's "keep something on screen" job if it crashes.
|
||||
# Managed by ansible (pi_kiosk role).
|
||||
#
|
||||
# Openbox is here for one concrete reason: a browser asks to be full-screen over EWMH,
|
||||
# and only a window manager answers that request. With no WM running, --kiosk was
|
||||
# silently ignored and Firefox fell back to its default 1280x972 window on a 1920x1080
|
||||
# screen - the page in the top-left corner with black bands down the right edge and
|
||||
# along the bottom. Openbox costs a couple of MB and does nothing else here.
|
||||
|
||||
xset s off
|
||||
xset -dpms
|
||||
xset s noblank
|
||||
|
||||
{% if pi_kiosk_mode == 'debug' %}
|
||||
# Debug session. Firefox is an ordinary window with its chrome (so devtools and the URL
|
||||
# bar are reachable) and is *not* relaunched when it exits - quitting it should leave a
|
||||
# usable desktop, not fight you for the screen. Openbox is the session leader instead:
|
||||
# when it exits (root menu -> Exit) the X session ends and .bash_profile starts a fresh
|
||||
# one. Right-click the desktop for a terminal.
|
||||
firefox "{{ pi_kiosk_url }}" &
|
||||
|
||||
exec openbox
|
||||
{% else %}
|
||||
openbox &
|
||||
|
||||
unclutter -idle 0.5 -root &
|
||||
|
||||
# The loop is what takes the place of a WM's "keep something on screen" job: Openbox
|
||||
# manages the window, but nothing else would bring Firefox back if it died.
|
||||
while true; do
|
||||
firefox --kiosk "{{ pi_kiosk_url }}"
|
||||
sleep 2
|
||||
done
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user