How to make a "kiosk"-application

The computer

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


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.


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


/usr/sbin/ntpdate -s

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
/usr/local/bin/xsetroot -solid Grey &

# show local time
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...
# The arguments to the application should take care of the x,y positon and
# the size of the window.
DISPLAY= ./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.


Remote update

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




Göran Hasse

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