3

I'm having trouble with running uzbl browser under matchbox-window-manager on a raspberry pi. I'm using it with a 22' lcd screen to display some info (temperatures, graphs, VPS server stats...).

What I actually did is: Set up the raspberry pi to start X at startup (raspi-config). Created /home/pi/.xsession with the following contents:

kiosk-browser &
exec matchbox-window-manager -use_cursor no -use_titlebar no

kiosk-browser contents:

#! /bin/bash

while true
do
    if [ $(pidof -x uzbl-core | wc -l | tr -s "\n") -eq 0 ]
    then
        uzbl -u http://localhost/ -n kiosk &
    fi


    memFree=$(grep MemFree /proc/meminfo | awk '{print $2}')

    if [ $memFree -lt 30000 ]
    then
        echo 'reload_ign_cache' > /tmp/uzbl_fifo_kiosk
    fi


    sleep 20
done

So you now see what I'm trying to achieve. I'm updating some divs contents and images using jQuery, and didn't find a better way not to freeze the pi after consuming all available RAM, as each browser I tested does this (after some significant ammount of time).

The problem I'm having with this setup is it sometimes doesn't reload the browser properly, but freezes instead. Sometimes with a black screen (as when the pi starts), sometimes it's white screen (uzbl loading html), and sometimes even sooner, before dismissing the old html contents.

So basically what I'm trying to ask is, is this setup ok? Is this how it's done, or am I missing something? :)

THANK YOU!

Kukosk
  • 151
  • 1
  • 1
  • 5
  • Try to break out the portions of your script into named functions, like uzbl_is_running() { ... pidof ...; }, making the purpose of each section easier to guess. –  Mar 16 '13 at 11:43
  • I'm not sure if this belongs in ServerFault - you're trying to setup a dashboard type system? Is it for home or will you deploy more than just this one? –  Mar 16 '13 at 11:47
  • I'm using this one for home purposes, as you say ... –  Mar 16 '13 at 12:08
  • If someone's more familiar with linux, especially X, let me know if the .xsession file is okay, and should work. Thank you :) – Kukosk Mar 16 '13 at 14:41
  • You might want to do without the exec unless there's a reason for that. Note that you don't have to run a window-manager; if all you want is the browser, just leave it at that. – goldilocks Mar 16 '13 at 15:09
  • maybe there's a way, but i haven't discovered it yet. When i run uzbl without a window manager, it runs well, but not @ fullscreen. It runs at cca 640x480 instead of 1366x768. about the exec. I found it in some tutorial where someone was using other window manager to run some app on debian (and raspberry pi I think). I don't know what's the point and purpose of the exec here :) thank you – Kukosk Mar 16 '13 at 15:42
  • It actually doesn't make a significant difference here (the exec), but it would if you moved that line, etc. exec replaces the shell with the command, as opposed to executing it within the shell, meaning the script will be defunct at that point. – goldilocks Mar 16 '13 at 16:03

1 Answers1

2

Thank you all for helping me! I managed to probably solved this with just using lightdm (no other window manager).

Contents of kiosk-browser now:

while true
do
    if [ $(pidof -x uzbl-core | wc -l | tr -s "\n") -eq 0 ]
    then
        uzbl -u http://localhost/ -n kiosk -g 1366x768+0+0 &
    fi


    memFree=$(grep MemFree /proc/meminfo | awk '{print $2}')

    if [ $memFree -lt 30000 ]
    then
        echo 'reload_ign_cache' > /tmp/uzbl_fifo_kiosk
    fi


    sleep 10
done

Then I edited /etc/lightdm/lightdm.conf to log in as 'pi' and use the 'kiosk' session:

autologin-user=pi
autologin-session=kiosk

And created a file @ /usr/share/xsessions/kiosk.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=kiosk
Type=Application
Exec=kiosk-browser

to start kiosk-browser when lightdm starts...

Kukosk
  • 151
  • 1
  • 1
  • 5