Live dynamic wallpaper in Linux using Extensions and Python with Shaders

3 min readApr 21, 2021

Only for KDE 5 (Plasma desktop) and Gnome 3 (Gnome Shell). Wayland and X11.

KDE 5 Plasma plugin

Install KDE / Plasma — Shader Wallpaper plugin github link.
Plugin can be installed directly from KDE Plasma desktop options. Instruction:

  • Right click on your desktop > Configure Desktop
  • Click on the “Get New Plugins” button
  • Search and Install the latest version of “Shader Wallpaper”

Warning: some of the shaders that installed by default in that “Shader Wallpaper” may crash GPU driver or have a very bad performance, click carefully.

For example - my own shader can be used as Desktop wallpaper for “Shader Wallpaper” plugin, download and instructions on this link.

Gnome Shell 3

I did not found any existing extension or tool for that, so I made my own simple python script and extension that support Wayland and X11.

Link to download and instructions. Includes Python script and Gnome Shell 3 extension.

To install Python app launch script.
To install Gnome Shell extension copy downloaded extension to the user extension folder. Instruction has steep by steep instruction.

Description for Python script:

I use Gtk.GLArea in python, and set window.set_type_hint(Gdk.WindowTypeHint.DESKTOP).
Python script supports Wayland and X11.

Wayland limitations do not allow to set WindowTypeHint.DESKTOP for the window.
And GLArea and other OpenGL context bugged in GnomeShell when forced X11 on Wayland. Set USE_WAYLAND=False in python script to test.

In Gnome Shell on X11 this python script works well without bugs.

Description for Gnome Shell extension:

I was planning to make a “full extension that supports buffers like on shadertoy and shadertoy shaders”… but the current state of gjs and Gnome Shell does not allow to do that.

Gnome Shell and gjs have no way to “free” VRAM after it allocated.
Because of this, my extensions can not be published on the Gnome extension website.
They require to free everything on disabling when gjs and Gnome Shell can not do that.
This my extension does not free itself, to not make VRAM leaks, it does show/hide on disabling/enabling the extension.

Link to video that displays gjs do VRAM memory leak. And a link to the used test code.

I stop on creating absolutely minimal Gnome Shell extension.
Minimal code can be found on this link to my github lineclock example extension code.
And can be used as a template for your Shader or Animation on Gnome 3 DE.

Minimal code has proper config window binding and using window created in Glade. Can be useful as an example of the extension that does animation.

More helpful links about creating Gnome Shell extension:

  1. Gnome forum and Matrix, they very active people there, question answered in minutes, very nice to see so active community and devs.
  2. Basic Guide for extensions in Gnome Shell.
  3. Docs for gjs and Gnome API bindings to Javascript.
  4. Gnome Shell UI source code very important information to make proper integration to Gnome Shell UI.
  5. Requirements and Tips for getting your GNOME Shell Extension approved and upload page to Gnome Shell extensions website. (extensions based on this code can not be uploaded because of the reason - gjs can not free VRAM)