Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:random_background [2011/05/23 03:38] – [View Random Images] Guywiki:random_background [2011/05/24 14:59] (current) – [Random Background Image] Guy
Line 7: Line 7:
 ==== Random Background Image ==== ==== 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.+You may have a number of images, and like a random background image each time you start the computer. You need persistent opt. Following is a guide on how this can be set up.
  
 Copy images to /opt/backgrounds. Copy images to /opt/backgrounds.
Line 13: Line 13:
 Open a text editor, and paste the following. Open a text editor, and paste the following.
  
-<code>#!/bin/sh+<code># This selects a random picture and changes the background image. 
 + 
 +#!/bin/sh
 cd /opt/backgrounds cd /opt/backgrounds
-/bin/rm -f changing.jpg +/bin/rm -f pic.jpg 
-RANGE=$(ls | wc -l) +NUMBPIC=$(ls | wc -l) 
-number=$((($RANDOM%$RANGE) +1)) +PICSEL=$((($RANDOM%$NUMBPIC) +1)) 
-BACKGROUND=$(ls | tail -$number | head -1) +PICCHANGE=$(ls | tail -$PICSEL | head -1) 
-cp $BACKGROUND changing.jpg +cp $PICCHANGE pic.jpg 
-hsetroot -full /opt/backgrounds/changing.jpg+hsetroot -full /opt/backgrounds/pic.jpg
 [ -x /usr/bin/wbar.sh ] && wbar.sh [ -x /usr/bin/wbar.sh ] && wbar.sh
 </code> </code>
  
-Save this as backg.sh in /opt. +Save this file as pic.sh in /opt. 
  
 Open the terminal and type Open the terminal and type
  
-<code>sudo chmod 775 /opt/backg.sh</code>+<code>sudo chmod 775 /opt/pic.sh</code>
  
-If you have persistent opt, and don't backup opt, add the following to /opt/shutdown.sh.+Add the following to /opt/shutdown.sh.
  
-<code>/opt/backg.sh</code> +<code>/opt/pic.sh</code>
- +
-If you backup opt, add the above code to /opt/bootsync.sh.+
  
 Restart the computer. Restart the computer.
  
-Opening the Control Panel, click Wallpaper, and select "changing.jpg."+Opening the Control Panel, click Wallpaper, and select "pic.jpg."
  
 You will now have a random background image each time you start the computer. You will now have a random background image each time you start the computer.
 +
 +If you use backup, and this is not working, set up persistent opt.
  
 ==== View Random Images ==== ==== View Random Images ====
  
-You may set it up to change random images at predetermined time intervals. The default is 10 seconds.+You may set it up to change random images at regular intervals. The default is 10 seconds.
  
-You could use it to display photos.+This could be used to display photos.
  
 After doing what has already been discussed above, open a text editor, and paste the following. After doing what has already been discussed above, open a text editor, and paste the following.
  
-<code>#!/bin/sh +<code># To be used with pic.sh 
-myvar=0 +# This changes the background image at regular intervals. 
-while [ $myvar -ne 5 ]+ 
 +#!/bin/sh 
 +V=0 
 +while [ $-ne 5 ]
 do do
-/opt/backg.sh +/opt/pic.sh 
-sleep 10+sleep 10  # Change this to the number of seconds you want it to wait.
 done done
 </code> </code>
  
-Save this as view.sh in /opt. +Save this file as view.sh in /opt. 
  
 Open the terminal and type Open the terminal and type
  
 <code>sudo chmod 775 /opt/view.sh</code> <code>sudo chmod 775 /opt/view.sh</code>
 +
 +Add the following line to /opt/bootlocal.sh
 +
 +<code>sudo cp /opt/view.sh /usr/sbin</code>
 +
 +Restart the computer.
  
 To view random images, open the terminal and type To view random images, open the terminal and type
  
-<code>/opt/view.sh</code>+<code>view.sh</code>
  
 To stop images changing (with the terminal open), press Ctrl+c. To stop images changing (with the terminal open), press Ctrl+c.
Line 97: Line 108:
 ==== Names with Spaces or Unusual Characters ==== ==== 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.+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.
  
Print/export
QR Code
QR Code wiki:random_background (generated for current page)