Quantcast
Viewing all articles
Browse latest Browse all 7

GNOME 3 Random Background Wallpaper Change Script

When I reformatted and installed Fedora 17 Linux, I needed a way to randomly change my background wallpaper. After about 30 minutes of google’ing, I could not locate any simple fedora 17 packages or pre-made extensions for GNOME 3. With the help from pender and kolo from this forum post I was able to get a stable script running. Below you can find the script and how to implement it into a working GNOME 3 desktop.

 

Image may be NSFW.
Clik here to view.
GNOME 3 Random Background Wallpaper Change Script

GNOME 3 Random Background Wallpaper Change Script

 

Random Background Wallpaper Change Script

#!/usr/bin/perl -w
use strict;
use warnings;

my $searchPath = '/adan/+MEDIA+/+IMAGES+/Wallpapers/+WALLPAPERS-1920x1080+/';   # Set to the directory you want to have searched for photos
my $switchTime = 3600;               # Edit to the number of seconds between photo switches

my @photos = `find $searchPath -type f | grep [jJ][pP][eE]*[gG]`;             
chomp(@photos);
my $photo;

while(1)
{
    $photo = $photos[rand($#photos)];
    `gsettings set org.gnome.desktop.background picture-uri "file:///$photo"`;
    sleep($switchTime);
}

Create a new file ‘background-changer‘ and copy + paste the above code into it.
Edit the 5th and 6th line to the configure the script.
Then you need to save it and make sure you ‘chmod +x background-changer‘ to make sure its executable.

 

Implementation

To auto run this script when you login, just add a new ‘Startup Application

yum -y install gnome-session-properties
gnome-session-properties

NAME: Background Changer
COMMAND: /home/djravine/Scripts/Background-Changer/background-changer (Location of the script)
COMMENT: A new random background every hour.

 

Image may be NSFW.
Clik here to view.
GNOME 3 Random Background Wallpaper Change Script - Gnome 3 Session Properties

GNOME 3 Random Background Wallpaper Change Script – Gnome 3 Session Properties

 

Now try a reboot and you should see a new random wallpaper every time.

 


Viewing all articles
Browse latest Browse all 7

Trending Articles