Compared to Windows and Apple, some people consider Linux distributions to be the most user-friendly, personally customizable operating systems available. They enable you to adjust and tweak pretty much anything you want to. All they require is a basic understanding of the dynamic of Linux.
One fun change you can make is customizing your desktop in a pretty unique way – by changing the background image every so often automatically. While some programs exist to help you with this task, there is absolutely no reason why you cannot do it yourself with a few simple commands. Before long you can have your entire vacation album scrolling behind your open windows, changing photos every five, ten, or thirty minutes – it’s entirely up to you.
To begin, open a terminal window and open a new text file:
gksu gedit
You are going to insert a line of commands into this file, which you will later turn into a shell script. The function of each line is outlined below; you only need to copy and paste the big block of text further down. The individual explanations are so you can customize the code to fit your needs.
picsfolder=”/media/documents/photosfordesktop”
This line points to whatever folder holds the photos you want scrolling in the background. Be sure to change it to whatever folder holds yours.
cd $picsfolder
This changes the current directory to the new folder full of pictures.
files=(././.jpg)
This creates an array out of all your photos, allowing them to be mixed up for display later.
N=${#files[@]}
This simply identifies the number of pictures in the new array.
((N=RANDOM%N))
This chooses a random photo from those you made available.
randomfile=`echo ${files[$N]} | cut –characters=”1 2” –complement`
This identifies the name of the specific photo chosen.
Gconfigtool-2 -t str –set /desktop/gnome/background/picture_filename “$picsfolder$randomfile”
This sets the desktop with your new (temporary) photo as the background.
Now, take all those commands, put together below, and copy and paste them into the text editor you opened earlier:
picsfolder=”/media/documents/photosfordesktop”
cd $picsfolder
files=(././.jpg)
N=${#files[@]}
((N=RANDOM%N))
randomfile=`echo ${files[$N]} | cut –characters=”1 2” –compliment`
Gconfigtool-2 -t str –set /desktop/gnome/background/picture_filename “$picsfolder$randomfile”
Save your text document as /bin/timedwallpaper.sh and exit the text editor. Everything is ready – now you just need to tell your computer to do it. For this next part your distribution needs to have “cron” installed, a program which typically comes pre-packaged. To make sure you have it, type
sudo apt-get install cron
Once you have ensured it is installed, type
crontab -e
At the bottom start a new line and type
*/5 * * * * timedwallpaper.sh
This sets the time between pictures at five minutes. Change the number to whatever you see fit. Arrow down to the next blank line, and then type
@reboot timedwallpaper.sh
After that, press Control+x, then y, and finally enter. Exit the terminal and you are good to go. Not only will your script run however often you program it to, it will now reset each time you start your computer as well. Enjoy the scenery!
The post Changing Your Linux Background Automatically appeared first on gHacks Technology News | Latest Tech News, Software And Tutorials.
by Melanie Gross via gHacks Technology News | Latest Tech News, Software And Tutorials » Linux
No comments: