Daily-Reddit-Wallpaper icon indicating copy to clipboard operation
Daily-Reddit-Wallpaper copied to clipboard

Suggestion: use a library for handling wallpaper

Open bharadwaj-raju opened this issue 8 years ago • 8 comments

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.

bharadwaj-raju avatar Jul 07 '16 17:07 bharadwaj-raju

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

remggo avatar Jul 07 '16 17:07 remggo

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'

remggo avatar Jul 10 '16 16:07 remggo

No, it works with 2 and 3.

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

bharadwaj-raju avatar Jul 11 '16 16:07 bharadwaj-raju

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 avatar Sep 03 '16 21:09 dolohow

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

bharadwaj-raju avatar Sep 04 '16 06:09 bharadwaj-raju

@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 avatar Nov 04 '16 09:11 remggo

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

bharadwaj-raju avatar Nov 04 '16 10:11 bharadwaj-raju

See PR #28

remggo avatar Nov 04 '16 13:11 remggo