Tag Archives: live wallpaper

Animated Plasma Wallpaper: Asciiquarium

Years ago, for KDE 3, I had ported a console “asciiquarium” to operate as a KDE screensaver, called “KDE asciiquarium“.  By KDE 4.2, it was included as part of the kdeartwork module by default.

Since the KDE 3 times when I started this screensaver, our desktop concept has changed around a bit.  We’ve developed the Plasma desktop, and have effectively deprecated the idea of screensavers (which are increasingly less popular), though lock screens are still important.

But not everything that changes is a negative: Plasma also supports “live” (or animated) wallpapers, including for lock screens.  After some pleas from users hoping for a Plasma 5 port of the screensaver, I started work about a year ago to see if I could port the screensaver to Plasma 5 as an animated wallpaper.

Screenshot of the running live wallpaper (set as the Plasma background)

I think I’ve succeeded in at least getting something to start with.  In fact I’ve been running this code for months, never quite finding time to work on it, and I figured maybe someone would be interested if I shared it out.

The code is available at my scratch KDE repository.  A packaged tarball of the initial release can be downloaded from here.

This version uses QML, which was quite a bit harder than I thought it would be, due to the desire to keep this “low res”.  For instance, instead of smoothly animating the fish with pixel precision, the code forces each fish to align to a text boundary (to simulate the effect of running the original TTY-based script).

To the Qt devs’ credit, I found that this was almost entirely doable in QML alone, thanks to its support for OpenGL shaders in its particle system.  In fact if you look at the QML code for the sharks you can see that I managed to get the shark sprite to be de-rezzed using vertex shaders alone.

This didn’t work for the individual fish; unfortunately I hadn’t found a way to both use vertex shaders for the fish and allow a per-particle sprite for the fish.  I’m sure this is just my inexperience with things; for now I create the fish in QML (in Component.onCompleted) but use a small C++ QML extension plugin to update their positions.  The C++ plugin is also used to create the pixmaps.  If it weren’t for these, the whole thing could notionally be in pure QML.

Unfortunately this isn’t anywhere near the greatness of the old version.  The shark sometimes dies early, and can’t kill the fish.  The air bubbles are missing (not that fish really produce bubbles anyways!), and we’re missing the other major ‘fun’ sprites like the sailing ship or, my favorite, the submarine.

But those nits aren’t getting fixed any faster hanging out on my hard disk, so I offer it up for wider consideration.