Home Store Blog Development

Xml wallpaper and exposing transition time to gsettings


#1

(Question at the end)

After getting the black background after trying to use a xml as wallpaper I did some research too see if I could get a dynamic wallpaper working.

I wrote a python script that reads a json(personally think its more readable but it can convert to xml) file containing a path to each image and the time of day I want the that image to be the wallpaper.

The script checks every interval amount of time(defined in the json file), does some math using the wallpaper time and the current time and selects the wallpaper closest to the current time, then runs command
gsettings set org.gnome.desktop.background picture-uri <image path>

Anyway, I went into the source code to see if I could customize transition speed.
I ended up adding transition-speed to com.solus-project.budgie-wm so I could change it from gsettings.

While in the code I saw a comment saying “do nothing with xml file” and after it sets the screen to black when passed an xml file.

Here are some examples(this is at 4x speed)
https://gfycat.com/OffbeatIdioticHind
https://gfycat.com/GrouchyGrotesqueAlaskankleekai

Example Json

{
  "updateInterval": 900,
  "wallpapers": [
    {
      "time": 0,
      "file": "/home/jonathan/Pictures/Wallpapers/mojave-background/mojave_dynamic_15.jpeg",
      "speed" : 100000
    },
    {
      "time": 3,
      "file": "/home/jonathan/Pictures/Wallpapers/mojave-background/mojave_dynamic_16.jpeg",
      "speed" : 100000
    },

Example Xml

<background>
  <starttime>
    <year>2014</year>
    <month>01</month>
    <day>11</day>
    <hour>0</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
  <!-- 00:00 -->
  <static>
    <duration>10795.0</duration>
    <file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_15.jpeg</file>
  </static>
  <transition type="overlay">
    <duration>5.0</duration>
    <from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_15.jpeg</from>
    <to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_16.jpeg</to>
  </transition>
  <!-- 03:00 -->

So questions are

  • Do we want to implement ubuntu’s way of handling this? (personally dont like the way they did it)
  • Do we want to expose transition time to gsettings?
  • Can we implement both of the above
  • Does anyone want to implement this or should I?
  • Last one: Why set the wallpaper to black, why not the budgie grey color?

#2

Just a few clarifications.

You started off discussing the .xml format then finished with json format… I’m a little confused!

The transition time is set in the .xml file - why the need for the gsettings value? To ignore/override the .xml value?

I’m not familiar with the “ubuntu way” … is the .xml format in ubuntu wallpapers different in someway from other distributions/upstream GNOME?

I know upstream has an issue for supporting .xml format - just no one has pitched in to support this. As long as it is written in Vala, any patch like this is more likely to be merged in.

Personally I don’t see any particular reason why black was chosen. No harm proposing a different colour for non-recognised wallpapers.


#3

Sorry, xml can be converted to json and vice versa. I used json because its more readable and modern.

If implemented it should probably use the same format as Ubuntu(I believe most distros kept the Ubuntu format) so the same xml file works on all the distros. The xml isn’t very readable in my opinion but there is already lots of wallpaper changing programs that read it.

The gsettings value so that people like me can write scripts to change it how ever they want. The same way you can change the wallpaper from gsettings in a script, applet, or application you write.

Currently the transition speed is only accessible from within the source code. If xml is implemented only, transition speed will still only be accessible from setting the wallpaper.


#4

ah - understand.

The upstream issue is this https://github.com/solus-project/budgie-desktop/issues/261

They would like the .xml support. I imagine they won’t mind also the json format also

If you are interested in writing a patch I would suggest draft a patch to budgie-desktop. I don’t mind adding my tuppence worth of advice if you want someone to look over your shoulder. Once done that you could raise a pull-request with a commit message that indicates it resolves that part of #261