Phosphor is a nice screensaver (at least, I love it) that scrolls a text on the screen in a old school 80’s style. On Ubuntu 7.10, it comes with xscreensaver-data-extra from universe repository.
I wrote a bash script to generate the text choosing a random fortunes from a folder ~/fortunes where I save the fortunes in a text file (the script doesn’t depends from fortune app) :

#!/bin/bash

# put the fortunes in an array
c=0
for i in `ls $HOME/fortunes/`;  do
        fortune[$c]=$i
        c=$c+1
done;

# count the fortunes
nb_fortunes=${#fortune[*]}

# take a random fortune from the array
fortune_out=${fortune[$((RANDOM%nb_fortunes))]}

# Now, output it
echo “—————————————————————————-”
echo “$USER@$HOSTNAME:`date +%H:%M:%S` ~>\$ cat fortunes/$fortune_out”
echo ” ”
cat $HOME/fortunes/$fortune_out

The next step is phosphor configuration, here’s the command I use to launch it :

phosphor -root -delay 57846 -scale 2 -ticks 13 -program /home/ayoli/local/bin/myfortunes

Replace /home/ayoli/local/bin/myfortunes with the path to your text generator application (which can also be a rss agregator, htop, or any other CLI app).

  • If you use Xscreensaver, launch xcreensaver-demo from a terminal, then choose phosphor screensaver, hit ’settings’ button and then ‘advanced’. Here you can enter the line.
  • Else if you use gnome-screensaver you need to edit, as super user, the file that gnome-screensaver uses to launch phosphor :
    sudo gedit /usr/share/applications/screensavers/phosphor.desktop

    find the line that begins with exec and paste your configuration line