Utilitaires
Scripts
Divers
Jeux
Rechercher
Quillevere.net
Computer techniques

Batocera: A loading and shutdown screen for your marquee

Créé le 11/10/2026

Wanting to display a standby image when booting up and shutting down Batocera on an arcade cabinet, I present my solution here.

When Batocera starts up, the main screen displays a splash screen?a static image (or a video, depending on your configuration) to keep the user waiting during the few seconds it takes to load. I wondered if it was possible to also display one on the marquee, which functions as a second screen.

Natively, unfortunately, nothing is provided to do this, so you have to use a specific script. This was created on the latest version of Batocera to date in 2026 (v43) on a Raspberry Pi 5 using Wayland as the display server (some steps may vary slightly depending on your system).

Test the display

Before moving on to the final configuration, it is best to check a few elements. Switch to the command line to do this.

  • Verify that multiple video outputs are indeed recognized on Batocera:
    batocera-resolution listOutputs
    batocera-settings-get-master global.videooutput2

    This should display HDMI-A-1, HDMI-A-2 for the first command and HDMI-A-2 for the second.

  • Find the window name for the Wayland Labwc display manager:
    grep -B 4 -i "HDMI-A-2" /userdata/system/.config/labwc/rc.xml

    This should display <windowRule title="backglass">

  • Push 2 images into a directory for startup and shutdown (I placed them in a directory created for the occasion /userdata/system/marquee).
    I am sharing the ones created for this occasion with you:
    My screen is 1920x360, but only the upper part is visible to the user (the first 260 pixels), hence the off-center title.
  • Display the image by entering the target window name (backglass) in the title:
    mpv --no-config --title=backglass --fs --video-align-y=-1 --image-display-duration=inf /userdata/system/marquee/demarrage.jpg
  • If everything went well, you can proceed to the final setup.

Setting up a service

To display the image, we will use a Batocera service, as it is recommended by the developers, suits our needs perfectly, and can be easily enabled or disabled through the interface.

  • If you haven't already done so, send your 2 images to the /userdata/system/marquee directory.
  • Create the service file (named Marquee Splash):
    touch /userdata/system/services/marquee_splash
    chmod +x /userdata/system/services/marquee_splash
    nano /userdata/system/services/marquee_splash
  • In the file that opens, paste the code that will handle the display and termination. You can, of course, adapt the parameters:
    #!/bin/bash
    # Affiche une image au démarrage et à l'extinction de EmulationStation
    # Eric Quillévéré (10/2026)
    TITLE_NAME="backglass"
    IMG_BOOT="/userdata/system/marquee/demarrage.jpg"
    IMG_STOP="/userdata/system/marquee/extinction.jpg"
    OPTS="--no-config --really-quiet --title=${TITLE_NAME} --fs --video-align-y=-1 --image-display-duration=inf"

    # Configuration des durées (en secondes)
    SLEEP_WAYLAND=0.05    # Pause entre chaque vérification de Wayland
    SLEEP_ES_CHECK=1        # Pause entre chaque vérification d'EmulationStation
    SLEEP_POST_BOOT=6      # Pause après la détection d'EmulationStation au démarrage
    SLEEP_POST_STOP=3      # Temps d'affichage de l'image d'extinction

    find_wayland() {
        for i in $(seq 1 400); do
            sock=$(ls /var/run 2>/dev/null | grep -E '^wayland-[0-9]+$' | head -n1)
            if [ -n "$sock" ]; then
                export XDG_RUNTIME_DIR=/var/run WAYLAND_DISPLAY="$sock"
                return 0
            fi
            sleep $SLEEP_WAYLAND
        done
        return 1
    }

    case "$1" in
        start)
            (
                find_wayland || exit 1
           
                mpv $OPTS "$IMG_BOOT" &
                for i in $(seq 1 90); do
                    wlrctl toplevel list 2>/dev/null | grep -q "EmulationStation" && break
                    sleep $SLEEP_ES_CHECK
                done
           
                sleep $SLEEP_POST_BOOT
                pkill -f "title=${TITLE_NAME}" 2>/dev/null
            ) &
            ;;
        stop)
            pkill -f "title=${TITLE_NAME}" 2>/dev/null
            export XDG_RUNTIME_DIR=/var/run
            sock=$(ls /var/run 2>/dev/null | grep -E '^wayland-[0-9]+$' | head -n1)
            [ -n "$sock" ] || exit 0
            export WAYLAND_DISPLAY="$sock"
            mpv $OPTS "$IMG_STOP" &
            sleep $SLEEP_POST_STOP
            ;;
    esac
  • Run the script to test it:
    /userdata/system/services/marquee_splash start
  • Finally, install the script as a service:
    batocera-services enable marquee_splash

There you go, you can now reboot to check the display when Batocera shuts down and boots up!

Upon shutdown, you will see an image like this one:

Going further by displaying the startup image earlier

You have probably noticed it: the startup image does not display right away. It is a bit annoying to have the loading standby image appear after 9 seconds on a Pi 5... But it is difficult to do better on this machine if we use services, because they launch late, after everything else in fact!

Therefore, here is how to scrape a few seconds off by displaying the image even earlier, before the services start up, by modifying the boot partition.

Warning: using this script carries more risk. Make sure you have network access to your machine via SSH in case you need to roll back

  • Create a specific shell file:
    touch /userdata/system/marquee/early_marquee.sh
    chmod +x /userdata/system/marquee/early_marquee.sh
    nano /userdata/system/marquee/early_marquee.sh
  • Paste the following script that will detect the startup of the Wayland display server and display the startup image:
    #!/bin/bash
    export XDG_RUNTIME_DIR=/var/run

    for i in $(seq 1 300); do   # 15 s max
        sock=$(ls /var/run 2>/dev/null | grep -E '^wayland-[0-9]+$' | head -n1)
        if [ -n "$sock" ]; then
            export WAYLAND_DISPLAY="$sock"
            wlr-randr >/dev/null 2>&1 && break
        fi
        sleep 0.05
    done
    [ -n "$WAYLAND_DISPLAY" ] || exit 0

    exec nice -n -10 mpv --no-config --really-quiet --title=backglass --fs \
         --video-align-y=-1 --image-display-duration=inf --load-scripts=no --ytdl=no --osc=no \
        /userdata/system/marquee/demarrage.jpg
  • Link it to startup by modifying the boot partition:
    mount -o remount,rw /boot
    cat > /boot/postshare.sh << 'EOF'
    #!/bin/bash
    setsid /userdata/system/marquee/early_marquee.sh >/dev/null 2>&1 </dev/null &
    EOF

    chmod +x /boot/postshare.sh
    mount -o remount,ro /boot
  • Test it: you should gain an additional 4 seconds of display time!
Quillevere.net

Commentaires

No inscription needed if you wish to

Search in this website

fr en rss RSS info Informations