UP | HOME

MinasMazar's blog ~ Project Kiosk

These are some notes on how I turned my Raspberry Pi into a Kiosk using Emacs.

The equipment:

Here's more details about Raspberry PI in kiosk mode.

(defun kiosk-picsum-wallpaper-stop-timer ()
  (interactive)
  (and (timerp picsum-wallpaper-timer-obj)
       (cancel-timer picsum-wallpaper-timer-obj)))

(defun kiosk-picsum-wallpaper-change ()
  (interactive)
  (let ((display-buffer-alist (list (cons shell-command-buffer-name-async (cons #'display-buffer-no-window nil)))))
    (async-shell-command "display -window root  https://picsum.photos/1920/1080.jpg" nil nil)))

(defun kiosk-picsum-wallpaper-start-timer ()
    (interactive)
    (setq picsum-wallpaper-timer-obj (run-at-time t (* 60 19) #'kiosk-picsum-wallpaper-change)))

Install midori.

sudo apt install midori

This is the shell script that will start midori in fullscrenn mode, showing our ~/tmp/index.html page.

#!/bin/bash

DISPLAY=:0 midori -e fullscreen file:///tmp/index.html

This reload the browser page each 2 minutes.

(defun midori-reload ()
  (shell-command "midori -e tab-reload"))

(defun midori-start-reload-timer ()
  (run-at-time 10 120 #'midori-reload))

;; (midori-start-reload-timer)

This is a sample index page written in org. You can export as HTML and show as the main content of our kiosk.

#+OPTIONS: toc:nil
#+HTML_HEAD: <script src="https://cdn.tailwindcss.com"></script>

#+CAPTION: A random photo
#+ATTR_HTML: :alt photo image :title Gallery
[[https://picsum.photos/1920/1080.jpg]]

Or you can just write yout own HTML.

<html>
  <head>
    <title>Emacs Kiosk</title>
    <script src="https://cdn.tailwindcss.com"></script>
  </head>

  <body>
    <img src="https://picsum.photos/1920/1080.jpg" class="w-screen h-screen"/>
  </body>
</html>

Date: 2024-10-28 Mon 00:00

Emacs 30.1 (Org mode 9.7.11)

Validate