Daily-Reddit-Wallpaper
Daily-Reddit-Wallpaper copied to clipboard
Suggestion: use a library for handling wallpaper
There is a library, libdesktop, that you can use to ease development, maintenance and add support for more platforms.
Install:
pip install libdesktop
And then it's just:
import libdesktop
libdesktop.set_desktop_wallpaper(image)
Also:
It even has a add_to_system_startup()
function, but probably you'll not want it since you want users to handle that through cron
/Task Scheduler.
I will look into it at the weekend. Sounds very promising to clean up code :+1:
Does this Library only work with Python 3? At the moment this Project works with Python 2 and 3, it would be unnecessary to add an library and losing support of Python2 without an functionality increase other than 'the code looks a little bit cleaner'
No, it works with 2 and 3.
(NOTE: Python 2 support is very recently finished and uploaded, please update)
Missing disclaimer:
bharadwaj-raju is the owner of the library
To be honest, I see no purpose in using library which is that new and it does not have a lot of activity, but keep up the good work!
@dolohow Well, I sure missed that :)
Anyway, if you don't like a library, here is the essence: https://gist.github.com/bharadwaj-raju/46ef4c76e4e72ae618f83a22bfde09bf
Then you can add that file (wallpaper.py) and call wallpaper.set()
.
@dolohow But maybe the use of libdesktop makes it possible to use this Script on a broader range of DEs. As far as I can tell this script only works with KDE, Gnome, Lxde, Xfce4 and Mate; whereas libdesktop supports all kinds of obscure DEs see @bharadwaj-raju his code for wallpaper.set()
@remggo Now, using the Gist above, you can paste the contents of said Gist into a file, import and call set()
See PR #28