piframe/docs/splash_screens.md

70 lines
2.3 KiB
Markdown
Raw Normal View History

# Splash Screens
The below will get you setup with splash screens for boot, shutdown and halt events on your PiFrame.
You will need to obtain your own images for these screens. Please adjust the following accordingly.
## Further Reading / Inspiration
* https://www.madebymany.com/stories/fun-with-systemd-running-a-splash-screen-shutting-down-screens-and-an-iot-product-service-with-python-on-raspberry-pi
* https://yingtongli.me/blog/2016/12/21/splash.html
* https://learn.adafruit.com/pitft-linux-python-animated-gif-player/python-code
``` sh
cat > /etc/systemd/system/boot-logo.service <<EOF
[Unit]
Description=boot splash screen
DefaultDependencies=no
After=local-fs.target
[Service]
User=fim
ExecStart=/usr/bin/fim --verbose --etc-fimrc /usr/local/etc/fimrc --no-commandline --no-history --device /dev/fb0 --vt 1 --execute-commands-early "clear" --execute-commands 'display;sleep "300";quit;' --autozoom /home/fim/noun_startup_749601.png
Type=exec
[Install]
WantedBy=sysinit.target
EOF
cat > /etc/systemd/system/shutdown-logo.service <<EOF
[Unit]
Description=show image on starting shutdown
DefaultDependencies=no
Before=halt.target poweroff.target reboot.target shutdown.target
[Service]
User=fim
ExecStartPre=-/usr/bin/killall fim
ExecStart=/usr/bin/fim --verbose --etc-fimrc /usr/local/etc/fimrc --no-commandline --no-history --device /dev/fb0 --vt 1 --execute-commands-early "clear" --execute-commands 'display;sleep "300";quit;' --autozoom /home/fim/noun_landing_1746270.png
Type=exec
[Install]
WantedBy=halt.target poweroff.target reboot.target shutdown.target
EOF
cat > /etc/systemd/system/halt-logo.service <<EOF
[Unit]
Description=safe-to-power-off image
DefaultDependencies=no
After=umount.target
Before=final.target
[Service]
User=fim
ExecStartPre=-/usr/bin/killall fim
ExecStart=/usr/bin/fim --verbose --etc-fimrc /usr/local/etc/fimrc --no-commandline --no-history --device /dev/fb0 --vt 1 --execute-commands-early "clear" --execute-commands 'display;sleep "300";quit;' --autozoom /home/fim/noun_unplug_601044.png
Type=exec
[Install]
WantedBy=halt.target halt.target poweroff.target reboot.target shutdown.target
EOF
systemctl daemon-reload
systemctl enable boot-logo.service
systemctl enable halt-logo.service
systemctl enable shutdown-logo.service
```