Change wallpaper at sunrise and sunset with Tasker
Today, I’ll explain how to configure Tasker to change wallpaper at sunrise and sunset. It is useful, for example, to set a darker wallpaper to relax your eyes at night.
Step 1. Prepare tasks
The first step is to create two tasks, one to run at sunrise and one to run at sunset.
Using the Set Wallpaper action, it’s possible to specify the picture to use and other parameters.
You can also decide to enable/disable the dark mode using the appropriate action. I have added a condition to do so only when it is on and not on auto mode.
Step 2. Configure Profile
There are two possible options based on your settings and needs.
Option 1. When Dark Mode is on
You can use this option if your phone automatically enables Dark Mode at sunset and disable it at sunrise.
Configure a profile in Tasker that triggers on state Dark Mode and set the Sunset task as Entering Task and Sunrise as Exiting Task.
Option 2. Calculate sunrise and sunset time
If your phone doesn’t have the previous setting, or you don’t want to use it, you can calculate the sunrise and sunset time based on your location.
This option uses the javascript file that you can download from the following page Sunrise/sunset — Tasker Wiki.
You need a new task, let’s call it Get Sunrise Time, two profiles to trigger it, and two profiles to start the Sunrise and Sunset tasks.
The Get Sunrise Time task performs the following actions:
- Get Location V2: determines your location.
- Variable Set: these two actions prepare the variables for the javascript file.
- Javascript: executes the file downloaded previously. It needs the path to the file.
- Variable Set: these two actions store the variables resulting from the javascript file.
Two profiles trigger the task execution:
- On Timezone Set event condition.
- On a Time condition.
With these two, it updates the sunset and sunrise time every day and immediately when you change the timezone.
Two profiles then trigger the Sunrise and Sunset tasks on the moments calculated by the Get Sunrise Time task.