How to make a "kiosk"-application

The computer

The computer could be any computer capable of running FreeBSD or Linux.

Image

The grid

Since you have to place the windows yourself on to the screen, is is handy to have a grid to work with. This is dependent on the resolution of your screen.

Image

The application

Since your application is without a window manager you yourself have to resize and position your window. In Gtk you do that with:

// You must hold width and height and position
// within the application...

static gint window_x_width = 300;
static gint window_y_height = 300;
static gint window_x_pos = 100;
static gint window_y_pos = 200;
...
gtk_window_move( GTK_WINDOW( window ), window_x_pos, window_y_pos );
...
gtk_widget_set_size_request (da, window_x_width, window_y_height);
...

Startup script

You have to install X-window on the system but without having the X-window start on boot.

This is how a startup script in FreeBSD could look like

/etc/rc.local
---
#!/usr/local/bin/bash

/usr/sbin/ntpdate -s 0.ubuntu.pool.ntp.org

DISPLAY=:0.0
export DISPLAY

/usr/local/bin/X -ac &

# Let the x-server have time to start
sleep 20

# Connect from any IP
/usr/local/bin/xhost + &

# Remove the cursor from the screen, turn off screensaver
/usr/local/bin/unclutter -root -idle 1 &
/usr/local/bin/xset -dpms &
/usr/local/bin/xset s off &

# set background
# https://en.wikipedia.org/wiki/X11_color_names
/usr/local/bin/xsetroot -solid Grey &

# show local time
TZ=CEST
export TZ
/usr/local/bin/xclock -geometry 384x307-0+0 &
...

#
# Infact... The application can be run on some other! computer.
# In the good old days we talked about X-terminals...
# https://en.wikipedia.org/wiki/X_terminal
#
# The arguments to the application should take care of the x,y positon and
# the size of the window.
#
DISPLAY=192.168.37.88:0.0 ./draw-text -x 0 -y 0 -X 896 -Y 307 -g logo -L "" -f 100 &

# And! some other applications...

---

The result

You will have a kiosk that run applications without a window-manager.

Image

Remote update

It is also possible to update the kiosk from other system by using, for example, Spread.

Image

Utvecklare

Image

Göran Hasse

Göran is a software developer working att Raditex Control AB