zzag / plasma5-wallpapers-dynamic

Dynamic wallpaper plugin for KDE Plasma
328 stars 18 forks source link

Storing the current wallpaper image for theming purposes #99

Open luisbocanegra opened 2 years ago

luisbocanegra commented 2 years ago

Would it be possible to save somewhere a snapshot of the current displayed image to be used for color scheme creators like pywal?

zzag commented 2 years ago

I saw your color scheme script on Kreddit and thought how to make it work with this wallpaper plugin. Off top of my head, I don't really know.

Depending on the dynamic wallpaper, this plugin can mix two images in order to provide smooth transition from one time to another. Also, if the geolocation is unknown and henceforth the Sun position can't be computed, the timings will be computed differently.

If it's possible to query properties set by wallpaper plugins using plasmashell's scripting api, this plugin could set several properties - two urls (filename + image index in the avif file) for current and next image, and the blend factor. Your script would query them and compute the color scheme.

luisbocanegra commented 2 years ago

Depending on the dynamic wallpaper, this plugin can mix two images in order to provide smooth transition from one time to another. Also, if the geolocation is unknown and henceforth the Sun position can't be computed, the timings will be computed differently.

That's very interesting, what I initially thought was to read the current image and find a way to replicate your logic from my script, but honestly didn't even know where to start.

If it's possible to query properties set by wallpaper plugins using plasmashell's scripting api,

Oh that's exactly what I'm doing using ~/.config/plasma-org.kde.plasma.desktop-appletsrc as a reference to find which properties can be read from the scripting api:

[Containments][1][Wallpaper][com.github.zzag.dynamic][General]
Image=file:///home/luis/Pictures/Dynamic/wallpaper.avif

this plugin could set several properties - two urls (filename + image index in the avif file) for current and next image, and the blend factor. Your script would query them and compute the color scheme.

That would be useful, I'll just have to find a way to extract the image based on that, it seems that pillow-avif-plugin could work but I have to test it first.

Edit: Okay getting the frames from python turned out to be easier than I thought, I can either use pillow_avif or run the command avifdec from libavif with the index to save the corresponding image.

zzag commented 2 years ago

I don't like storing the current state in the config file, the plugin won't use it. Can you check whether wallpaper properties are readable using plasma's scripting api?

luisbocanegra commented 2 years ago

I don't like storing the current state in the config file, the plugin won't use it. Can you check whether wallpaper properties are readable using plasma's scripting api?

Sorry for the delayed reply.

I checked the scripting api documentation and it doesn't seem to be a way of querying the current wallpaper, only reading and writing plugin and widget configs for plasma layouts. I think it's the same reason Latte Dock dev psifidotos did this for the slideshow plugin to get the current wallpaper.

zzag commented 2 years ago

Interesting.. This wallpaper plugin could register a dbus service to get the current images.