Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Support for Dynamic Wallpappers supported by other DEs like Gnome/Cinnamon/Mate #70

Open
snaggen opened this issue Nov 4, 2024 · 4 comments

Comments

@snaggen
Copy link

snaggen commented Nov 4, 2024

It would be nice to have support for the same dynamic wallpapers as Gnome/Cinamon/Mate since Fedora provides a few out of the box, and there are collections to be found (Just googled and found https://github.com/saint-13/Linux_Dynamic_Wallpapers/ for example). And there are tools available to create them https://github.com/maoschanz/dynamic-wallpaper-editor

I haven't been able to find any official spec, but the xml format seems to be quite straight forward.

An example of the default Fedora 41 Wallpaper

<background>
  <starttime>
    <year>2024</year>
    <month>10</month>
    <day>22</day>
    <hour>8</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at 8 AM. -->

<!-- We start with day at 8 AM. It will remain up for 10 hours. -->
<static>
<duration>36000.0</duration>
<file>/usr/share/backgrounds/f41/default/f41-01-day.png</file>
</static>

<!-- Day ended and starts to transition to night at 6 PM. The transition lasts for 2 hours, ending at 8 PM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/usr/share/backgrounds/f41/default/f41-01-day.png</from>
<to>/usr/share/backgrounds/f41/default/f41-01-night.png</to>
</transition>

<!-- It's 8 PM, we're showing the night till 6 AM. -->
<static>
<duration>36000.0</duration>
<file>/usr/share/backgrounds/f41/default/f41-01-night.png</file>
</static>

<!-- It's 6 AM, and we're starting to transition to day. Transition completes at 8 AM. -->
<transition type="overlay">
<duration>7200.0</duration>
<from>/usr/share/backgrounds/f41/default/f41-01-night.png</from>
<to>/usr/share/backgrounds/f41/default/f41-01-day.png</to>
</transition>

</background>
@kbhasi
Copy link

kbhasi commented Dec 10, 2024

I do agree with this, in particular because Debian does a similar thing, as their default backgrounds are created as multiple SVG files for different screen resolutions, then they use a dynamic background XML file to set backgrounds for different screen resolutions in GNOME.

They probably use this same file in other desktop environments too, but I didn't feel like trying to spin up an extra VM to test.

Here's the gnome-background.xml file for the default background in Debian 12, to provide an example.

<background>
  <static>
    <duration>8640000.0</duration>
    <file>
      <size width="1280" height="800">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/1280x800.svg</size>
      <size width="1280" height="1024">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/1280x1024.svg</size>
      <size width="1600" height="1200">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/1600x1200.svg</size>
      <size width="1920" height="1080">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/1920x1080.svg</size>
      <size width="1920" height="1200">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/1920x1200.svg</size>
      <size width="2560" height="1440">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/2560x1440.svg</size>
      <size width="2560" height="1600">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/2560x1600.svg</size>
      <size width="3200" height="1800">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/3200x1800.svg</size>
      <size width="3200" height="2000">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/3200x2000.svg</size>
      <size width="3840" height="2160">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/3840x2160.svg</size>
      <size width="5120" height="2880">/usr/share/desktop-base/emerald-theme/wallpaper/contents/images/5120x2880.svg</size>
    </file>
  </static>
</background>

The XML file would be stored in the contents folder referenced in the file paths above, with the images folder next to it and containing the actual background files.

COSMIC not yet supporting SVG backgrounds, as far as I can tell, may likely be an upstream issue with image-rs not supporting SVG.

I haven't been able to find any official spec, but the xml format seems to be quite straight forward.

Debian's file name of gnome-background.xml suggests to me that this may be more of a GNOME thing that other desktop environments later implemented.

@mmstick
Copy link
Member

mmstick commented Dec 10, 2024

COSMIC not yet supporting SVG backgrounds, as far as I can tell, may likely be an upstream issue with image-rs not supporting SVG.

It doesn't matter if image-rs supports it or not. SVG support could be implemented by using resvg.

@kbhasi
Copy link

kbhasi commented Dec 10, 2024

SVG support could be implemented by using resvg.

Right! I had a bit of a half-and-half decision about that and was busy at the time so I didn't check, but thinking about it now, supporting a second library or crate just for SVG files would make more sense. I hadn't yet checked to see how other desktop environments handle this, but I'm certain they too use separate libraries for raster and vector image rendering.

@mmstick
Copy link
Member

mmstick commented Dec 10, 2024

We're already using different crates for image codecs not supported by image-rs, such as jpeg XL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants