Change wallpaper using KWLP and Tasker

Alberto Piras
Geek Culture
Published in
3 min readMay 2, 2024

--

Photo by Grabster on Unsplash

Some years ago, I wrote this article on how to change wallpaper at sunrise and sunset. While I am still using similar profiles and tasks, except for some extra conditions and wallpapers based on habits, I experimented with KWLP to see if it was possible to achieve the same result.

KWLP

KLWP is a tool to create and customize the wallpaper on your phone with the information you wish to see. It’s a combination of wallpaper and widgets.

It’s also a Tasker plugin, which allows us to integrate it with our current setups.

Configuration

Tasker

Let’s start by creating a task that can be attached to our existing profiles.

The first action is the Variable Set. It will define a %kustomVariable with a text value used in KWLP to identify the image to use as wallpaper.

Variable Set configuration

The second action is the Plugin > Kustom LWP > KLWP Send Variable.

KLWP Send Variable configuration

By pressing the button next to the Configuration headline, it’s possible to set which variable Tasker should send to KWLP. In the example above, the %kustomVariable will be broadcasted as the wallpaper variable.

Task configuration

Above, it’s possible to see the configured actions.

Live Wallpaper

Switching now to KWLP, let’s set up the wallpaper.

After opening the editors, the first step is to head to the Globals tab and add some Bitmap variables.

Define Globals

Next, press the Pick Image text and select the image you want to associate with each variable.

I defined the following global variables.

  • light: contains a wallpaper for the day.
  • focus_l: contains one for when I need to focus during the day.
  • dark: is a wallpaper for the night.
  • focus_d: is the one for when I need to focus at night.

The next step is to switch to the Background tab, select the checkbox on the right of Bitmap, and press the calculator icon on the top right.

Background tab

This operation will switch the Bitmap from an image to a formula. Clicking the calculator icon next to it allows to configure the formula.

The formula I used is as follows.

$if(br(tasker, wallpaper)="light",gv(light),br(tasker, wallpaper)="dark",gv(dark),br(tasker, wallpaper)="focus_d",gv(focus_d),br(tasker, wallpaper)="focus_l",gv(focus_l))$

It uses the following Kustom Functions. Check the official website for all the available functions.

  • br: allows retrieving a variable broadcasted from Tasker and other applications.
  • gv: gets a global variable.
  • if: allows defining conditions.

Therefore, the formula above checks the wallpaper variable from Tasker. If the value is light, it uses the image defined in the light global variable. Otherwise, it checks the subsequent condition till it finds one that is true or there are none left.

Putting it together

Running the task created above, the live wallpaper refreshes and the image associated with the light global variable gets set.

Final result

Conclusion

This solution allows changing wallpaper more smoothly since KWLP is a live wallpaper, and Tasker does not change any system setting.

As a side effect, the Material You theme engine does not detect the wallpaper change or update the colour palette. Multiple users have had this problem, but it’s not a known issue, and no fix exists.

--

--

Alberto Piras
Geek Culture

Software development engineer at Amazon. Thoughts and articles are my own.