This is an old revision of the document!


View Random Image

Ordinary Background Image

Copy image to /opt/backgrounds. To select background image, open the Control Panel, and click Wallpaper.

Random Background Image

You may have a number of images, and like a random background image each time you start the computer. Following is a guide on how this can be set up.

Copy images to /opt/backgrounds.

Open a text editor, and paste the following.

#!/bin/sh
cd /opt/backgrounds
/bin/rm -f changing.jpg
RANGE=$(ls | wc -l)
number=$((($RANDOM%$RANGE) +1))
BACKGROUND=$(ls | tail -$number | head -1)
cp $BACKGROUND changing.jpg
hsetroot -full /opt/backgrounds/changing.jpg
[ -x /usr/bin/wbar.sh ] && wbar.sh

Save this as backg.sh in /opt.

Open the terminal and type

chmod 775 /opt/backg.sh

If you have persistent opt, and don't backup opt, add the following to /opt/shutdown.sh.

/opt/backg.sh

If you backup opt, add the above code to /opt/bootsync.sh.

Restart the computer.

Opening the Control Panel, click Wallpaper, and select “changing.jpg.”

You will now have a random background image each time you start the computer.

View Random Images

You may set it up to change random images at predetermined time intervals. The default is 10 seconds.

You could use it to display photos.

After doing what has already been discussed above, open a text editor, and paste the following.

#!/bin/sh
myvar=0
while [ $myvar -ne 5 ]
do
/opt/backg.sh
sleep 10
done

Save this as view.sh in /opt.

Open the terminal and type

chmod 775 /opt/view.sh

To view random images, open the terminal and type

/opt/view.sh

To stop images changing (with the terminal open), press Ctrl+c.

This will change the image every 10 seconds. To change the time interval, edit the file /opt/view.sh, and change the line

sleep 10

Make this the number of seconds you want it to wait before changing images.

If you use this to display images, you may want to remove the wbar, by including the bootcode

noicons

in the bootloader.

Restart the computer for this to take effect.

You may also want to disable power management, to prevent the screen from going off. To do this open ~/.xsession, and add the line

xset s off

Restart the computer for this to take effect.

Print/export
QR Code
QR Code wiki:random_background (generated for current page)