The Ubuntu 12.10 upgrade last October broke a lot of Compiz plugins. This is because the Compiz decided to clean up their code, which in turn that some of the less used plugins were broken and disabled. Ubuntu 12.10 shipped with Compiz 0.9.8, but without a lot of the plugins. One of these is the wallpaper plugin, which allows for a different wallpaper per work-space, something I have been using for a few years now on both Ubuntu, and Debian before that.
One might ask why you would need Compiz something as simple as changing your wallpaper. The simple answer is that Gnome just doesn’t support the same features that Compiz does. One can only specify a single wallpaper, or a collection of wallpapers. All work-spaces will always display the same wallpapers however. There have been a few attempts that I know of that address this issue, like Nitrogen. None of these allow the amount of control and flexibility that I desired, so I eventually created my own script and put it on Github. This script uses the aforementioned Compiz plugin, so the script broke when I upgraded to Ubuntu 12.10.
Fixing the broken plugins
Luckily, I recently noticed that the Compiz team has been working on restoring the broken plugins. Indeed, one of the more recent commits fixes this bug, and the plugin now works again. This fix will be included in Compiz 0.9.9, which I assume will be used in Ubuntu 13.04. You can, however, already run this new version of Compiz on 12.10, by installing the Compiz packages from the Compiz Staging PPA.
Just add the repository:
root@asura:~# add-apt-repository ppa:unity-team/staging You are about to add the following PPA to your system: This archive contains the latest builds generated from trunk, that have passed the unit tests, but didn't pass the user acceptance (autopilot) tests yet. Unless you are a developer and know what you do here, you should probably use the "unity-team/ppa" instead. More info: https://launchpad.net/~unity-team/+archive/staging Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmppivnjb/secring.gpg' created gpg: keyring `/tmp/tmppivnjb/pubring.gpg' created gpg: requesting key 1236960C from hkp server keyserver.ubuntu.com gpg: /tmp/tmppivnjb/trustdb.gpg: trustdb created gpg: key 1236960C: public key "Launchpad PPA for Unity Team" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK
This PPA includes packages for both quantal (12.10) and raring (13.04). I did notice while playing around with the packages, that the version for quantal breaks Unity, and causes it to not start. I then tried to install the version for raring, which worked fine. To achieve this, copy your
sources.list file to
sources.list.d, and change all occurrences of quantal to raring:
root@asura:~# cp /etc/apt/sources.list /etc/apt/sources.list.d/raring root@asura:~# vim /etc/apt/sources.list.d/raring # Change all occurrences of quantal to raring and save the file. # Pro-tip: :%s/quantal/raring/
Next, change all occurrences of quantal to raring in the
sources.list.d file for the Compiz Staging PPA:
root@asura:~# vim /etc/apt/sources.list.d/unity-team-staging-quantal.list # Change all occurrences of quantal to raring and save the file. # Pro-tip: :%s/quantal/raring/
To avoid pulling in all of raring whilst installing the new Compiz packages, add a pinning rule to
root@asura:~# vim /etc/apt/preferences.d/raring # Add the following to the file Package: * Pin: release n=raring Pin-Priority: 50
Update your package lists:
root@asura:~# apt-get update
And finally, update the relevant Compiz packages. Note that we specifically specify the raring distribution using
root@asura:~# apt-get install -t raring compizconfig-settings-manager compiz unity unity-common libbamf3-1
After this, you’ll have to re-login or reboot to start using the new Compiz. If everything went well, you’ll be greeted with the same familiar Unity interface. Compiz however, will now have the wallpaper plugin available, which we’ll use in the next section.
If Unity doesn’t properly start at this point, you’ve probably hit a bug in the new packages. As these packages are dailies, they might include some bugs. To fix this, disable the sources.list files you added earlier, and re-install the packages using
-t quantal. This should downgrade the packages to the version included in quantal. If THAT doesn’t work, then it’s probably time to start Googling.
The wallpaper changing script that I put on Github can use the wallpaper plugin of Compiz to randomly change your wallpapers. To use it, you’ll need:
Why both GraphicsMagick and ImageMagick? Because GraphicsMagick is quite a bit faster than ImageMagick, but I haven’t been able to use it to create the final background image. I still try to take advantage of GraphicsMagick by only using it for the intermediate files. You can, however, also just use ImageMagick for both tasks, by changing the configuration file later.
To use it, first clone the repository to somewhere:
chaos@asura ~ $ git clone git://github.com/LordGaav/changebackground.git Cloning into 'changebackground'... remote: Counting objects: 30, done. remote: Compressing objects: 100% (17/17), done. remote: Total 30 (delta 15), reused 27 (delta 12) Receiving objects: 100% (30/30), 5.99 KiB, done. Resolving deltas: 100% (15/15), done.
Next, copy the default config file:
chaos@asura ~ $ cd changebackground/ chaos@asura ~/changebackground git::master u= $ cp changebackground_config.php.default changebackground_config.php
Change the config file based on your preferences:
- IMAGEDIR: put the absolute path to your directory of images here. All PNG, JPG and GIF files will be used.
- TEMPDIR: all cache files and final files will be put here. If your / or /tmp is small, you might want to change this.
- GEOMETRY: put your resolution here. If you have multiple monitors with different resolutions, you’ll probably want to use the largest.
- TILES: 1×1 is a single desktop, 2×1 is a dual desktop with the monitors horizontally, 1×2 is a dual desktop with the monitors vertically. Other values are probably also supported, so test accordingly if you have particularly unique monitor setup.
- WORKSPACE: the amount ‘virtual’ desktops you have in Gnome/Compiz. On default Ubuntu, this is 4.
- DESKTOPS: 1 for a single monitor, two for two monitors, etc.
- MONTAGEMETHOD: crop for best fit, scale for fit to desktop.
- TEMPEXT: determines the file format of the intermediate files. jpg is usually acceptable.
- TEMPMETHOD: GMagickConsole is the fastest, IMagickConsole also be used.
- FINALEXT: determines the file format of the resulting files. jpg is usually acceptable.
- FINALMETHOD: use IMagickConsole, because GMagickConsole won’t work.
When that’s all done, change the absolute path to the changebackground script in
background.sh to its actual location.
Finally, use CompizConfig Settings Manager (in package ccsm) to enable the wallpaper plugin in Compiz. Also make sure you enable the JPEG plugin or whatever TEMPEXT/FINALEXT you chose.
Now you can call the changebackground script directly to configure Compiz and change the wallpaper. If you want to do this automatically, add a launcher to
background.sh to Startup Applications in Unity.
Big fat gotcha
In the steps above we added a pinning rule for the raring repository. This will probably cause problems when raring actually comes out, because we gave all packages in that repository a lower priority. I’m not sure if the Ubuntu upgrades handles this properly, but you should remove the pinning rule when you’re ready to update to 13.04. You might even have to uninstall the daily Compiz packages for the upgrade to work.
If all of the above is too much work, then you can always wait for Ubuntu 13.04 to come out. I’m pretty sure the new 0.9.9 version will be included. Also note that the changewallpaper script works fine on Ubuntu version 12.04 and lower.