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.

# This selects a random picture and changes the background image.

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

Save this as pic.sh in /opt.

Open the terminal and type

sudo chmod 775 /opt/pic.sh

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

/opt/pic.sh

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

Restart the computer.

Opening the Control Panel, click Wallpaper, and select “pic.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

sudo 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.

View without Wbar

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.

Turn Off Power Management

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.

Names with Spaces or Unusual Characters

You cannot load an image with a space in it's name, or certain other characters, such as brackets. If an image file has a space, brackets, or other unusual characters, rename it, excluding these, and it will work.

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