Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write a bash script which can remove the current wallpaper from the wallch playlist. By playlist, I speak of that list in wallch to which you can add pictures and folders, telling wallch that it can use these as wallpaper.

How is this playlist stored by wallch? sqlite? xml? Can I access and modify this playlist programmatically?

share|improve this question
have you tried "man wallch" for info – Ringtail Mar 1 '12 at 0:36
@BlueXrider Yes, the man page is rather small, and I found nothing. – Shawn Mar 1 '12 at 0:48

It would be rather difficult to remove the current wallpaper from Wallch's list while Wallch is running and chaning wallpapers, as the list is accessed by memory (also saved in ~/.config/Wallch/MainWindow.conf, but it is not read by there live, this location is used to restore the playlist, if e.g. computer is crashed or program is not shut down properly).

It would be much easier to make a script that autochanges the background while reading an album.wallch file using the command

gsettings set org.gnome.desktop.background picture-uri "/path to image/here.jpg"

and a 'while' loop. Example:

while read line; do
   gsettings set org.gnome.desktop.background picture-uri "$line"
   #here do what you want, remove image from the file being read, move image to trash
   #(located in ~/.local/share/Trash/files) and mark it as not wallpaper material.
   sleep $timeout #<- sleep the timeout you want until the next image
done < album.wallch

Another solution, but too complicated would be the following:

  1. Start Wallch normally and add some images, if there aren't any in the list
  2. Quit Wallch (Ctrl+Q)
  3. Start Wallch in a terminal using the command wallch --constant
  4. Remove the corresponding wallpaper from ~/.config/Wallch/MainWindow.conf
  5. Do whatever you want to do.
  6. Repeat from step 3.

But I would really suggest the 1st solution, making your very own script for this, if you want to use Wallch only for changing the background image, you should totally use the direct command

gsettings set org.gnome.desktop.background picture-uri "/path to image/here.jpg"
share|improve this answer
Would it work if I shut Wallch before removing the wallpaper from the list? I could take a note of the current wallpaper, change wallpaper, shut wallch, remove previous wallpaper, start wallch again. Does that make sense? And for the curious, I put almost every image file I have in that list and I'm making various keyboard shortcuts to easily triage all my images (move image to trash, open in gimp, mark as not wallpaper material, etc.) – Shawn Mar 1 '12 at 5:27

I use wallch and generally don't like it: It's a pain to modify the list of files (as you see). It is, however, possible to make yourself a directory full of soft links, and have wallch display those. Then, your script can monkey with the soft links, and wallch won't even notice. Use the "ln" command with -s to set up a soft link. If you have /home/me/Pictures/Backgrounds as the directory with the links in it, you do something like

ln -sf /home/me/Pictures/Vacation2013/GreatPic.jpg /home/me/Pictures/Backgrounds/1.jpg

to replace file "1.jpg" in the Backgrounds directory. It will link to GreatPic.jpg in the other directory, and can easily be replaced programmatically. Use soft links (-s option) so you don't hard-link the images. Use the "force" option (-f or -sf) to delete and replace existing links or files in the directory.

One problem: this approach doesn't let you change the number of backgrounds wallch displays. You only get to change which pictures they are.

I tried the gsettings command, and found that the "path" part needs to have the format file:/blah/blah/blah. I was surprised to see that http://server.tld/blah/blah/blah doesn't work.

Is being able to do something with or to the currently displayed background important? Then you'd probably be better off running a Python or Perl script (whatever you are familiar with), and handling signals. For example, you could give your script a signal handler that makes it delete the currently displayed file (if that's the sort of thing you intended).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.