Make your own picture-changing wallpaper in Gnome3

[Edit – April 2014]: I noticed my python script here didn’t do a very good job at not showing the same wallpaper twice before all wallpapers in a folder were shown. Hence, I created another simpler version of the script in bash that does a better job at that. You can find it here

I hoped Gnome3 would have had an integrated function to create custom wallpapers that change throughout the day by picking a folder with your images and choose some refresh interval, but still you have to rely on external scripts or programs.

I’ve been using WallCh for quite some time under Unity, and it suited me well. It was a bit too much for what I wanted to actually do, grabbing pictures in a folder and set them as wallpaper every 3 minutes that is.

Another thing that “annoyed” me is that while in Unity minimized windows are quite the same thing as background processes — in that they just stay on the Unity dash and as long as you don’t hit Alt+Tab they never show up — in Gnome3 I very often go through the list of all open applications, and WallCh by default is always there. I’m not a fan of Alt+Tab in Gnome3: I find it faster to hit Super with my left hand and click on a window I instantly recognize with my right hand than to cycle through small pictures with titles. I don’t know whether WallCh has an option to run in the background, but if it does I didn’t instantly find it and I opted for a little DIY πŸ˜›

That being said I thought that surely a simple command must exist to just change the wallpaper, and it does! It’s gsettings, with its org.gnome.desktop.background keys. So, to set your ~/Images/1080p/wall_0.png as background you just call

gsettings set org.gnome.desktop.background picture-uri file://$HOME/Images/1080p/wall_0.png
gsettings set org.gnome.desktop.background picture-options zoom

you can just add these two system calls in some simple script in whatever language you like and there you have your custom wallpaper changer!

I came up with a simple python script which is actually a stripped-down version of this nice little script by Romano Giannetti. I simply removed all verbosity and moved the pictures folder definition to a properties file that is checked at every interval, so I never have to change the script itself. If anyone is interested, I’ll post it (it’s less than 50 LOC in the end).

Then, I added the script as a startup application with gnome-session-properties so I finally have my lightweight background wallpaper changer πŸ™‚

Edit: as Romano himself asked for it, here’s my version of the script: http://pastebin.com/embed_iframe.php?i=UGYNi0K5

Well, if truth be told my version of the script has no error checks whatsoever, but since somebody may try to use this I thought that some information on what’s going on may be helpful. You can list several folders in the configuration file; if you change the configuration file while the script is running the list gets parsed again and reset.

12 thoughts on “Make your own picture-changing wallpaper in Gnome3

      • I’m ok with it. By the way, how do you manage an added image file to one of the directory, without changing the conf file? Will it be ever picked up?

        Like

      • ha! I didn’t think about that! Thanks πŸ™‚
        Now it deals with new files being added, and it updates the current round accordingly (where a round is a single permutation of all files in all configured folders): this means that if we have images A, B and C and a new image D is added after B and A have been set as wallpaper, images C and D will be set before A or B may be showed again. Every round is shuffled so as to avoid the same sequence running all over again. So much for the “stripped down” version πŸ˜€

        Like

  1. Hey there,

    Love the script, it’s exactly what I was looking for. It bothered me that the way I run it from gnome-session-properties launches multiple processes after a suspend so I added a pid file check and signal traps to clean up the pid:

    http://pastebin.com/iaC6MRZf

    The only thing I want to add now is a way to “fade out/in” the backgrounds – any idea where I might start looking for something like that? I don’t even know where to begin.

    Cheers

    Like

  2. Perfect!!! I was looking around for something “else”–Cortina, BackSlide/Random Walls, DesktopNova & the rest fell flat in one way or another (Random Walls worked the best unless I was running BOINC Manager & changing the desktop at the same time–caused a “minor” Gnome 3 crash when the GPUs were running @ 90+% –shut off all the extensions) 😦

    Came across your script & BAM! everything works-as-expected (TM) Can’t say thank you enough!!!! I can say with experience that the script keeps right on working as you throw new files in the folder….very nice!

    This is a “trick” that I’ve filed away in my backups so I won’t forget it.

    Like

  3. Yes–I didn’t want all the “bells & whistles”–just something to change the wallpaper in a timed fashion & this fit the bill to a “T” And like your comment–it seems like all the “major” players do a pseudo-random switch–I was tired of seeing the same picture several times in the same day & others not at all….. Your approach takes care of that.

    Liked by 1 person

    • Yes — my original version also took care of it (modulo any bug) as well as reloading the thing if a new pictures is added ( I do not move images though; it would wreak havoc with my multi-pc sync strategy. All is done internally). It is true that the randomness is restarted every time a new image is dropped in the folder — it could be fixed, but I am very sparingly adding images there ;-).
      (Hey, could not avoid replying to an Opus fan!)

      Liked by 1 person

Leave a comment