Ubuntu: Change your wallpaper with PHP

In your home directory, put all the wallpapers you like.

The script is rather simple:

#!/usr/bin/php
<?php
$path = '/home/xxxxxxx/wallpapers/';
$files = scandir($path);
$files = array_slice($files, 2);

	for($i = 1; $i 

You can get KCron to set this script as a cron job in your system (sudo apt-get install kcron). Unless you like to edit the jobs manually, of course. I find KCron very easy to use, despite it being a KDE program.

Remember that the command to use is:

php -f /home/XXXXX/path/to/script.php

Or, you can make the script an executable and skip “php -f”.
That’s it! Enjoy!

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: