[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.
Happy to help. And yes, publish your version too, so I can learn how you do it!
LikeLike
There you go! I hope you’re ok with the “licensing”.. π
If not I’ll change it straight away, of course!
LikeLike
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?
LikeLike
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 π
LikeLike
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
LikeLike
as a matter of fact I never checked the PIDs so your changes are very welcome!
For background transitions I stumbled onto this answer to a question on askubuntu, and it seems that you can define transitions using XML files as backgrounds, give it a look!
LikeLike
[…] The previous wallpaper changer that I wrote in Python served me well for the last 2 years, but sometimes it would get stuck with some wallpapers: of the 200 pictures I have in my wallpapers folder (mostly taken from the paper wall), some were definitely being shown more often than others. Has the script developed a taste? Probably! π […]
LikeLike
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.
LikeLike
that’s great to hear π
sometimes simplicity pays off, I guess!
LikeLiked by 1 person
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.
LikeLiked 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!)
LikeLiked by 1 person
π So the response would have to be AAAAACK…… LOL…
Have a Great Day & a equally Great New Year!!!!
LikeLiked by 1 person