Skip to content

Instantly share code, notes, and snippets.

@trongthanh
Last active January 26, 2023 19:04
Embed
What would you like to do?
macOS Mojave dynamic background re-implement as GTK+ background slideshow. Background images are changed to reflect the time of the day.
<!-- Instructions:
- Download and unzip Mojave dynamic background here: https://files.rb.gd/mojave_dynamic.zip
- Rename the extracted folder as "mojave-background" (Excuse the trouble but I renamed it on my machine and already use that path in the XML file)
- Save this xml file next to the Mojave background files
- Fix the path to the background images below (better using absolute path)
- Lastly, either:
+ GNOME: Use gnome-tweaks tool to select this XML as wallpaper (as default wallpaper settings won't let you choose wallpaper from custom path)
+ MATE: Go to background setting (in Appearance) > Choose +Add... > make sure **All files** filter is selected at the bottom right > Then choose mojave.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 -->
<static>
<duration>10795.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_16.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_16.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_1.jpeg</to>
</transition>
<!-- 05:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_1.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_1.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_2.jpeg</to>
</transition>
<!-- 06:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_2.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_2.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_3.jpeg</to>
</transition>
<!-- 07:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_3.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_3.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_4.jpeg</to>
</transition>
<!-- 08:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_4.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_4.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_5.jpeg</to>
</transition>
<!-- 09:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_5.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_5.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_6.jpeg</to>
</transition>
<!-- 10:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_6.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_6.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_7.jpeg</to>
</transition>
<!-- 11:00 -->
<static>
<duration>7195.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_7.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_7.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_8.jpeg</to>
</transition>
<!-- 13:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_8.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_8.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_9.jpeg</to>
</transition>
<!-- 14:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_9.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_9.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_10.jpeg</to>
</transition>
<!-- 15:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_10.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_10.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_11.jpeg</to>
</transition>
<!-- 16:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_11.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_11.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_12.jpeg</to>
</transition>
<!-- 17:00 -->
<static>
<duration>3595.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_12.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_12.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_13.jpeg</to>
</transition>
<!-- 18:00 -->
<static>
<duration>7195.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_13.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_13.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_14.jpeg</to>
</transition>
<!-- 20:00 -->
<static>
<duration>10795.0</duration>
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_14.jpeg</file>
</static>
<transition type="overlay">
<duration>5.0</duration>
<from>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_14.jpeg</from>
<to>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_15.jpeg</to>
</transition>
</background>
@sojusnik
Copy link

sojusnik commented Jul 4, 2018

@trongthanh: BTW, do you know if it's actually possible to define a whole folder with pictures as a path?
The idea is to have 4 folders - morning, day, evening, night - and show pictures from them in a certain period of the day. Just like your script does now, but only with 4 intervals and the pictures should be fetched from certain folders.

@trongthanh
Copy link
Author

@sojusnik Why don't you just pick 4 images (from the 16 ones) represent 4 shift of the day and then write a new XML file with interval of 24/4 = 6 hours? I don't think it's possible to set the background image with a folder path.

On a side note, Github Gist won't send emails to notify owners, so I cannot reply immediately. I'll just check back here for comments periodically. Other comments mentioned here won't receive notifications either. After posting it here, I just realize Github Gist sucks at helping with notifications.

@yurwpjt
Copy link

yurwpjt commented Jul 22, 2018

Can i make a youtube video about it on elementary OS?

@trongthanh
Copy link
Author

Hi @yurwpjt. Sure, no problem.

@trongthanh
Copy link
Author

Hi all,

If you'd like to comment or contact me, please do so at my blog post about this Mojave background slideshow: https://int3ractive.com/2018/07/macos-mojave-dynamic-wallpaper-for-linux.html

Because GitHub Gist will not notify commenters and owners at all.

@janoamaral
Copy link

janoamaral commented Sep 14, 2018

Hi, you can replace "/home/thanh/Pictures/wallpapers/mojave-background" with a placeholder (i.e. REPLACE)

Before
<file>/home/thanh/Pictures/wallpapers/mojave-background/mojave_dynamic_14.jpeg</file>

After
<file>REPLACE/mojave_dynamic_14.jpeg</file>

and use this script

#!/bin/bash
BASE=$(readlink -f "$0")
BASE_PATH=$(dirname "$BASE")
sed -i "s|REPLACE|$BASE_PATH|g" "$BASE_PATH/mojave.xml"

Run it inside the same directory of the images and mojave.xml. It replace all instances of REPLACE with the full path of the images

@kode54
Copy link

kode54 commented Dec 20, 2018

Any chance of a tool for processing the base64 encoded data from an existing dynamic wallpaper .heic? I'd also like to convert the Solar Gradients background, as silly as that may sound.

@jasonames42
Copy link

jasonames42 commented Dec 26, 2018

This is beyond my abilities, but I have all the ingredients worked out if someone wants to pick up the ball and make a script that...

  1. Gnome has 'Night Light' that knows local sunup/sundown, pull those times somehow, and extend by an hour on each end (for dawn, and dusk)
  2. Alter the duration each photo in the mojave.xml so that the pictures have a duration of:
    Pictures 14, 15, 16, "sundown->sunrise" (total night seconds/3)-5 (minus 5 is for the transition)
    Pictures 2-12 sunrise->sundown (total day seconds/13)-5
    Pictures 1 and 13 I just do for an hour, before sunrise, after sunset
    Picture 15 should run half as long, twice, and be the start and end of the rotation, as picture 15 should straddle midnight

Then the user can run the script every now and then to adjust for local day/night

Reference:
Picture 1: Dawn
Picture 2: Sunrise
Picture 7: High Noon
Picture 12: Sunset
Picture 13: Dusk
Picture 15: Midnight

I made a spreadsheet that does the math if anyone wants to manually make different ones. I made 3 seasonal files, equinoxes are the same. (In upstate NY the daylight varies quite a bit, from 9 hours to 15.5)

@hawk291
Copy link

hawk291 commented Jan 6, 2019

Hello, thanks! Is it possible to have a more smooth effect when a wallpaper changes ? I mean more a gradual switch.

@ahmubashshir
Copy link

Is it possible in xfce?

@thelcrysis
Copy link

thelcrysis commented Apr 6, 2019

Shouldn't it be like https://gist.github.com/thelcrysis/7c3563352de9b3467015fb0b3ceb184d

All changes are in <duration></duration> provided that comments refer to time of the day.

@SuvanshKumar
Copy link

There seems to be a mismatch in the timings of the pictures written in the xml. Time starts with 00:00, then fast-forward to 3 hours (10795 seconds), it is 03:00. Then fast-forward 3 more hours (10795 seconds), and it is only 05:00? Shouldn't it be 06:00?

@gxhamster
Copy link

Guys lets hope he write a script to set this up

@MichaelB7
Copy link

Here's a tip - everything works much smoother if you just move the jpeg files and the xml file to the top of the /Home/Pictures directory and modify the xml script appropriately, e.g for me lines 20-23:

 <!-- 00:00 -->
  <static>
    <duration>10795.0</duration>
    <file>/home/michaelb7/Pictures/mojave_dynamic_15.jpeg</file>
  </static>

of course all 48 file lines will need ot be changed. You can also use it for your lock screen, which is pretty cool. Use Tweak app to select xml file as before.

@guvarallo
Copy link

Anyone else having issues with smooth transitions? I'm on Ubuntu 20.04, and the pictures just abruptly change from one to another.

@ellipsiis
Copy link

Hello dude, thanks fot this guide but I have error with day hour, when is day, the wallpaper is night and when is night, wallpaper is day. How I can fix this inverse hours?

@saint-13
Copy link

saint-13 commented Mar 30, 2021

Anyone else having issues with smooth transitions? I'm on Ubuntu 20.04, and the pictures just abruptly change from one to another.

hello @guvarallo, that's because of short transition time (only 5 sec), I edited this script, and added smooth transition. i will upload that script in my GitHub with bunch of other dynamic wallpapers ( here ). Also everyone can easily modify or make new wallpaper scripts with program called "Dynamic Wallpaper Editor", which is preinstalled on Manjaro gnome edition.

Screenshot from 2021-03-30 17-05-33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment