There’s a little program available for windows that lets you turn your browser into a screensaver, looping through various web content. However, there are 2 things wrong with it. Firstly it costs money. Secondly it doesn’t run on linux.

So what? – we have bash – and after a bit of digging around this morning and combining a few bits and pieces this is my version for Ubuntu :)

Firstly, in order to run firefox full screen we need the AutoHide plugin, which appears to have been written by someone with an interesting sense of humour.

Secondly, a small alteration needs to be made to theĀ  javascript prefs file (.mozilla/firefox/$profile/prefs.js, $profile = your profile). THIS MUST BE DONE WITH THE BROWSER CLOSED as Firefox overwrites the file on shutdown. Add these two lines at the end of the file:

user_pref("browser.link.open_external", 1);
user_pref("browser.link.open_newwindow", 1);

Now that’s done there’s just a little bash script. Feel free to hack but if you improve it please let me know! I just saved the following few lines as a file “Webscreen” in my home directory:

#!/bin/bash

remoteclient=$(find /usr/lib/ -type f -name mozilla-xremote-client | grep -m 1 xulrunner)

if [ `ps -e | grep firefox | wc -l` -eq 0 ]; then

    /usr/bin/firefox -fullscreen &
    sleep 5

fi

while [ `ps -e | grep firefox | wc -l` -gt 0 ]; do

    urls=$(cat /home/huff/Desktop/pages)

    for i in $urls
        do
        $remoteclient -a firefox "openurl($i)"

        if [ $? -gt 0 ]; then
            echo "Firefox not running or ignoring me, bailing out...."
            killall firefox
            exit 0
        fi
        sleep 15
        done
done
exit 0

Note the path to the mozilla-xremote-client – this is correct on Ubuntu Jaunty but I had to use find to well, you know, find it:

find /usr/lib -iname \*mozilla-xremote\*

As can be seen the script takes the pages you want to cycle through from a text file called (I felt quite pleased with this) “pages” on the Desktop, one url on each line such as:


http://bbc.co.uk
http://flickr.com
http://yoursite.whatever.com

and scrolls through the selection every 15 seconds.

The last detail is to

chmod +x ~/Webscreen

and add a Custom Application Launcher to the panel. Thanks to mozilla for continuing the command line options started by Netscape and the cool AutoHide plugin, this was pretty easy. Hope it helps someone.