plasma5-wallpapers-dynamic icon indicating copy to clipboard operation
plasma5-wallpapers-dynamic copied to clipboard

Storing the current wallpaper image for theming purposes

Open luisbocanegra opened this issue 2 years ago • 5 comments

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

luisbocanegra avatar Apr 14 '22 00:04 luisbocanegra

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.

zzag avatar Apr 14 '22 10:04 zzag

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.

luisbocanegra avatar Apr 14 '22 15:04 luisbocanegra

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?

zzag avatar Apr 17 '22 17:04 zzag

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.

luisbocanegra avatar Apr 20 '22 01:04 luisbocanegra

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

zzag avatar Apr 21 '22 07:04 zzag