How to run a web browser as a screensaver

7,708

If you're lazy and just want it to work, run this at terminal and choose the links you want to view

cd ~/ && https://www.dropbox.com/s/yr17e7p7prae4o1/firefoxscript.sh && chmod +x ~/firefoxscript.sh && ~/firefoxscript.sh && rm ~/firefoxscript.sh    

Step by step instructions:

This is what you want (reference):

1) THIS MUST BE DONE WITH THE BROWSER CLOSED as Firefox overwrites the file on shutdown
- Open your firefox prefs file: gedit .mozilla/firefox/*default/prefs.js
(*default = your profile diretory)

  • Add these two lines at the end of the file:

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

2) Create a file (gedit ~/.webscreen) and paste this into it:
(change /home/huff/Desktop/pages to the right path of your user)

#!/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

3) Make the file ~/.webscreen executable (Here's how to do that).

4) Create a file named "pages" at your Desktop gedit ~/Desktop/pages with the links you want:

Example:

http://bbc.co.uk

http://flickr.com

http://yoursite.whatever.com

5) Add a Custom Application Launcher to the panel.

Enjoy! And thanks to mcmlxxii ;-)

Share:
7,708

Related videos on Youtube

dotnetrocks
Author by

dotnetrocks

Top StackOverflow users in Warsaw SRE at Sumo Logic

Updated on September 17, 2022

Comments

  • dotnetrocks
    dotnetrocks over 1 year

    I would like to set up a custom application (a separate profile of Firefox browser in my case) to be fired instead of screensaver. I am using Gnome desktop environment. Technically it doesn't have to be a screensaver (xscreensaver, gnome-screensaver). What I want is for the application to be run whenever no keyboard/mouse input has been received for N minutes and to disappear (or minimize) after pressing a key.

    Is it possible?

    EDIT: Originally I've asked about Firefox only, but I would be fully satisfied with any other reasonable browser (like Chrome?).

  • dotnetrocks
    dotnetrocks about 13 years
    Reformatted your answer.
  • desgua
    desgua about 13 years
    Edited to make it easier to understand.
  • pythonwhut
    pythonwhut over 6 years
    @desgua could you upload this firefoxscript file again? The link seems to be dead.. Many thanks!
  • desgua
    desgua over 6 years
    @sal of course! I have updated the link through my mobile phone. Right now I don't have any computer to test it. Can you please confirm that everything is OK?
  • Dɑvïd
    Dɑvïd over 6 years
    The link works for me . . . (FWIW!) Impressive this was first posted in 2011. :)