ssimunic / Daily-Reddit-Wallpaper

Change your wallpaper to the most upvoted image of the day from /r/wallpapers or any other subreddit on system startup
http://ssimunic.github.io/Daily-Reddit-Wallpaper/
GNU General Public License v3.0
306 stars 51 forks source link

Suggestion: use a library for handling wallpaper #19

Open bharadwaj-raju opened 8 years ago

bharadwaj-raju commented 8 years ago

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.

remggo commented 8 years ago

I will look into it at the weekend. Sounds very promising to clean up code :+1:

remggo commented 8 years ago

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'

bharadwaj-raju commented 8 years ago

No, it works with 2 and 3.

(NOTE: Python 2 support is very recently finished and uploaded, please update)

dolohow commented 8 years ago

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!

bharadwaj-raju commented 8 years ago

@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().

remggo commented 7 years ago

@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()

bharadwaj-raju commented 7 years ago

@remggo Now, using the Gist above, you can paste the contents of said Gist into a file, import and call set()

remggo commented 7 years ago

See PR #28