Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

Dynamic Background #32

Open
JP-Ellis opened this issue Apr 5, 2014 · 9 comments
Open

Dynamic Background #32

JP-Ellis opened this issue Apr 5, 2014 · 9 comments

Comments

@JP-Ellis
Copy link

JP-Ellis commented Apr 5, 2014

Hi,

I was wondering whether it is possible to configure elegance-colors so that it uses a dynamic background in order to infer the colours.

I currently have a dynamic desktop background which changes colour based on the time of day. It is a series of stripes (inspired by Gnome 3.8 background) but in the morning for example they are cyan, in the afternoon they turn green, at dusk they become orange, at night they are black, etc.

Additionally, the colours in my case change over the course of an hour or two. Would it be possible for elegance-colors to change along with it? In that time period, there is no single image file which has exactly what is displayed (unless Gnome internally creates one).

Thanks

@satya164
Copy link
Contributor

satya164 commented Apr 5, 2014

Hi. This feature is currently absent. Mainly because I'm not aware of any method which will let me get the current wallpaper in case of a xml slideshow.

However, you can use Variety or similar applications which also support dynamic backgrounds which is supported by Elegance Colors.

@JP-Ellis
Copy link
Author

JP-Ellis commented Apr 6, 2014

I'm not sure how Gnome generates the background but I thought this feature could be implemented by first parsing the XML file and generating a colour profile for each of the pictures that it calls, and then blend the colour profiles based on the timing information within the XML file.

How does Elegance Colors support Variety and similar applications?

@satya164
Copy link
Contributor

satya164 commented Apr 6, 2014

Variety doesn't use XML. It directly sets the background.

Anyways, parsing the XML file and getting the current wallpaper according to time seems impossible, because it also depends on when you have set the wallpaper. Right?

@JP-Ellis
Copy link
Author

JP-Ellis commented Apr 6, 2014

Actually, I don't believe so. In my case at least, the backgrounds change at set times throughout the day in a predictable way and I have only seen examples which do that. (I cannot seem to find the official Gnome specifications regarding the XML specifications...).

As an example, I have placed my XML file below. I have added comments which should make it clear how it works.

<background>
  <starttime>
    <!--<year>2013</year>-->
    <!--<month>1</month>-->
    <!--<day>1</day>-->
    <hour>9</hour>
    <minute>30</minute>
    <second>00</second>
  </starttime>

  <!-- This animation will start at 9:30 AM. -->

  <!-- 9:30 - 11:30: Morning -->
  <static>
    <duration>7200.0</duration>
    <file>.local/share/backgrounds/stripes/morning.jpg</file>
  </static>

  <!-- 11:30 - 13:00: Morning -> Afternoon -->
  <transition type="overlay">
    <duration>5400.0</duration>
    <from>.local/share/backgrounds/stripes/morning.jpg</from>
    <to>.local/share/backgrounds/stripes/afternoon.jpg</to>
  </transition>

  <!-- 13:00 - 17:00: Afternoon -->
  <static>
    <duration>14400.0</duration>
    <file>.local/share/backgrounds/stripes/afternoon.jpg</file>
  </static>

  <!-- 17:00 - 18:00: Afternoon -> Dusk -->
  <transition type="overlay">
    <duration>3600.0</duration>
    <from>.local/share/backgrounds/stripes/afternoon.jpg</from>
    <to>.local/share/backgrounds/stripes/dusk.jpg</to>
  </transition>

  <!-- 18:00 - 19:00: Dusk -->
  <static>
    <duration>3600.0</duration>
    <file>.local/share/backgrounds/stripes/dusk.jpg</file>
  </static>

  <!-- 19:00 - 20:00: Dusk -> Evening  -->
  <transition type="overlay">
    <duration>3600.0</duration>
    <from>.local/share/backgrounds/stripes/dusk.jpg</from>
    <to>.local/share/backgrounds/stripes/evening.jpg</to>
  </transition>

  <!-- 20:00 - 23:30: Evening -> Night -->
  <transition type="overlay">
    <duration>12600.0</duration>
    <from>.local/share/backgrounds/stripes/evening.jpg</from>
    <to>.local/share/backgrounds/stripes/night.jpg</to>
  </transition>

  <!-- 23:30 - 00:30: Night  -> Late Night -->
  <transition type="overlay">
    <duration>3600.0</duration>
    <from>.local/share/backgrounds/stripes/night.jpg</from>
    <to>.local/share/backgrounds/stripes/late_night.jpg</to>
  </transition>

  <!-- 00:30 - 05:30: Late Night -->
  <static>
    <duration>18000.0</duration>
    <file>.local/share/backgrounds/stripes/late_night.jpg</file>
  </static>

  <!-- 05:30 - 6:30: Late Night -> Dawn -->
  <transition type="overlay">
    <duration>3600.0</duration>
    <from>.local/share/backgrounds/stripes/late_night.jpg</from>
    <to>.local/share/backgrounds/stripes/dawn.jpg</to>
  </transition>

  <!-- 06:30 - 08:00: Dawn -->
  <static>
    <duration>5400.0</duration>
    <file>.local/share/backgrounds/stripes/dawn.jpg</file>
  </static>

  <!-- 08:00 - 09:30: Dawn -> Morning -->
  <transition type="overlay">
    <duration>5400.0</duration>
    <from>.local/share/backgrounds/stripes/dawn.jpg</from>
    <to>.local/share/backgrounds/stripes/morning.jpg</to>
  </transition>

</background>

@satya164
Copy link
Contributor

satya164 commented Apr 7, 2014

Yeah, this XML file changes according to the time of the day. But not every XML file. Different wallpapers have different timings, and sometimes different structure, which makes it hard.

@JP-Ellis
Copy link
Author

JP-Ellis commented Apr 7, 2014

I have actually had a look online, and every example I have found is the same as the example I have displayed. Sure different wallpapers have different timings, but these are all specified in the XML file and every XML file has the same structure. The only difference I can see is whether the reference time is completely specified (as in, "2013-01-01 00:00") or not (as with my example). If it is not specified, then it would be a simple matter of going back in the past and finding the first match.

If the worry is whether the cycle repeats on an daily bases, well, I don't see how that would be an issue. If the algorithm can deal with a cycle length of 86400 seconds, then I don't see how 50 seconds or 314159 seconds should be any different.

@satya164
Copy link
Contributor

satya164 commented Apr 7, 2014

I remember seeing those files with different structures. And by structure I don't mean syntax, it's the arrangement of tags, which tags present or not. Following is the default background slideshow shipped in Fedora 20, which clearly omits lots of stuff.

<background>
  <starttime>
    <year>2013</year>
    <month>08</month>
    <day>30</day>
    <hour>00</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<static>
<duration>10000000000.0</duration>
<file>
    <!-- Wide 16:9 -->
    <size width="1920" height="1080">/usr/share/backgrounds/heisenbug/default/tv-wide/heisenbug.png</size>
    <!-- Wide 16:10 -->
    <size width="1920" height="1200">/usr/share/backgrounds/heisenbug/default/wide/heisenbug.png</size>
    <!-- Standard 4:3 -->
    <size width="2048" height="1536">/usr/share/backgrounds/heisenbug/default/standard/heisenbug.png</size>
    <!-- Normalish 5:4 -->
    <size width="1280" height="1024">/usr/share/backgrounds/heisenbug/default/normalish/heisenbug.png</size>
</file>
</static>

</background>

Also, every XML file may not have the starttime mentioned, as it's not strictly required, and some may not have the hour mentioned too. Without this information, its impossible to calculate the current wallpaper. And about going back in the past and finding the first match, I don't have a TARDIS. :p

So, the problem is, depending on the various different structures of the XML files, and the calculation involved, it's very much difficult to determine the current wallpaper, and even then that it won't support all slideshows.

Also, not many users request for this feature either. Patches are welcome though.

@JP-Ellis
Copy link
Author

JP-Ellis commented Apr 8, 2014

I don't see how that XML file is any different. It displays a static image based on how wide the screen is (which would be not too hard to parse).

I will have a look through your code and may fork it if I find time to implement this feature; it would be nice if this Gnome shell theme supports the default way Gnome implements backgrounds (other than direct images).

@satya164
Copy link
Contributor

satya164 commented Apr 8, 2014

@JP-Ellis Well, depending on the free time I have, working on this is certainly difficult for me.

Also, one more thing. Elegance Colors periodically checks if the wallpaper is changed. If this feature is implemented, it'll need to periodically parse the XML, which will be have more impact on resources.

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

No branches or pull requests

2 participants