69 comments

[ 4.8 ms ] story [ 128 ms ] thread
So the animated wallpaper scene on linux is pretty bizarre. There are some popular methods out there like calling `feh --fill-bg` continuously in a bash loop but it sends your CPU usage to an astronomical 40% which drains the laptop battery pretty quickly. I couldn't find a reasonable animated desktop wallpaper setter, so I wrote a little utility in 150 lines or so in C that I call from .xinitrc to randomly pick a fairly unobtrusive desktop scene when I startx.

Quick youtube showcase: https://www.youtube.com/watch?v=6ZTiA885bWM

Really it should be something built in to the DE. You need it to stop rendering when the background is covered.
You can accomplish this with straight X11, no need for the DE to be aware of it.
I don't think that's so trivial in a composited world. IIRC once upon a time you could easily get a viewable state from the X server for windows, but with compositing xorg made it basically always true.
In wayland it's very simple. You would use surface frame callbacks, which aren't supposed to trigger when the window is fully obscured, minimized, or off-screen on another desktop. This mechanism never seems to have made it back into composited X.
(comment deleted)
for animated stuff I had good results with setting mpv as background. though yours looks like it uses even less CPU, super nice :) will work wonders with https://1041uuu.tumblr.com stuff !

... or at least it would, if I was seeing my desktop background once in a while

> ... or at least it would, if I was seeing my desktop background once in a while

One of the very few reasons I miss stacking window managers:)

>setting mpv as background

how does one do this? Just replace the Feh call with mpv?

True that, MPV is solid. Paperview gives me ~3% cpu usage and ~9% GPU usage on an old x230, while MPV gives me 40% cpu usage for a similar mp4. MPV works great on desktops with mp4s, while paperview is great for laptops and battery life if 15 frame gifs are being rendered (pixel art, of course!)
Did you create those scenes yourself? They look fantastic.
(comment deleted)
>There are some popular methods out there like calling `feh --fill-bg` continuously in a bash loop but it sends your CPU usage to an astronomical 40% which drains the laptop battery pretty quickly

Is this true when you have a loop that sleeps for 5 minutes before calling it again? I've always set my wallpapers this way. It's also similar to what I do on Sway. The only alternative I've found is simple enough and still works is using an ad-hoc systemd timer task.

Edit: nevermind, I forgot this is about animated wallpapers. I use a while loop + feh for setting a static wallpaper that changes every 5 minutes.

I love the focus on reducing CPU, GPU, and battery consumption... but it's still going to be distracting.
Yeah. I don't mean to be disrespectful to the OP, but what's the point of having wallpapers, anyway? Distraction is one thing, but it's also obstructed when you open a large window. I can kind of understand having a screensaver with a beautiful picture, but today screensavers are things of the past.
It's the same reason I change my icons and desktop theme. I'm gonna stare at this screen for 10+ hours a day, I want it to be beautiful.
At the cost of usable? IDK about that tradeoff. With the wallpaper specifically, it's always covered, at least on all the computers I use.
Doesn't the example video show all four cores mostly hovering at around 40-50% CPU usage (with occasional dips to 10-20%)?

What else was the machine doing at the time?

Heh, recording. My thinkpad is a little too slow.
most of xscreensaver's hacks will use the root window if you ask them too.

I'm using GLava [1] to put an audio spectrograph up on one side of my desktop, i run it with windowed games and transparency and so on and its never more than a 5% of CPU that I've ever seen.

[1] https://github.com/jarcode-foss/glava

no link for xscreensaver, jwz doesn't like hacker news

xscreensaver is nice when you eliminate all the "busy" modes and then turn down all the sliders on each mode you have left so that it moves very slowly.

the only thing i haven't figured out is how to get the fonts working again.

Excellent! Some of those backgrounds look like they’re from SvC: Chaos.
I think they are. It's a popular collection of 'fighting game backgrounds with nice pixel art' that get posted around pretty often.
Live wallpapers would be much more compelling if the background had context-awareness of what was in the foreground and could interact and animate in a way that augmented the foreground apps instead of just being pretty. Maybe with smart people, future OSes will make that possible.
I used to care about my desktop background. But as I've gotten older I find the only time I see it is when I close every window, and sometimes I can go for weeks without closing every window. So now I just leave it as the default because I look at it <1% of the time anyway
Yup, its ctrl-alt-t the moment DE loads.
I played around with transparent terminals over tranquil underwater videos for a bit. It was nice, but needed a bit too much resource.
I just use a plain black background.
I set a solid purple background because I feel unused screen space is a waste.
I mostly work in a terminal, developing in a text editor, and have my terminal background set to 80% opaque so that I can see my background.

Every 15 minutes I pull a random image from /r/earthporn. I enjoy having a "window" into the world :-)

Screenshot: https://imgur.com/fkXYD07

I admit, that's pretty sweet.
When my main computer was Linux laptop, I used xplanet as my desktop background. World clock, basic weather..

This was in 2003. It would get lots of interest when I was working in public places.

Which is why, somewhere over Greenland, a flight attendant came by and very quietly said to me, “I noticed you work on outer space stuff. We just got word over radio that the Space Shuttle blew up.” :-(

Very strange that the memory of that interaction would come to me about 8 hours after a more robust reentry vehicle splashed down in Florida.

http://xplanet.sourceforge.net/

That must have felt very tragic and awkward.
Xplanet is the only animated wallpaper I've even seen used. Most people would try it back in the early 2000 and then come to the conclusion that it wasn't worth the CPU cycles after a few minutes.
You can do live wallpaper with xscreensaver

set XSCREENSAVER_WINDOW

'-root' often works just as well

ex: /usr/lib/X11/xscreensaver/molecule -root

will start molecule on the root window

You can do live wallpaper with xscreensaver

To quote the man page:

XSCREENSAVER_WINDOW Passed to sub-programs to indicate the ID of the window on which they should draw. This is necessary on Xinerama/RANDR systems where multiple physical monitors share a single X11 "Screen".

-root often works just as well.

Really wanted this years ago when I was using Compiz/Beryl. Great job finding an efficient (in terms of power and cpu strain) implementation!
Isn't it possible to use mpv for this?

  mpv --wid=0
Causes mpv to draw to the root window.

I even found a guide:

https://github.com/digip/linux-video-wallpaper

Not sure what the performance is like though.

Performance is pretty good, probably even better than TFA, due to the hardware decode of the video.

That said, in both cases transparency of things like terminals is going to be very resource hungry.

Also, if you're doing the --wid=0, throw in --loop there too. :)

The style of the wallpapers and animations reminds me of the Windows 95 Plus theme pack. There was something that animated once every few minutes, but I can't recall what exactly…
Would that work with TWMs like i3? Most animated wallpaper programs I tried didn't work correctly.
Looking at the video, I guess the author uses I3.
Is there a decent repository for these kind of short animated backgrounds? Ideally pixel graphics like the one in the preview video. I'd like to experiment with this, but a quick duckduckgo search didn't turn up much; some sites were advertising images as animated but they were in fact still images, and most of the others had gifs of varying quality, and weren't even consistently 1080p.
Try stock hd video sites like videezy.com. You'll have to convert the hd videos into suitable format yourself though, but that should be easy enough.
I have 3 screens. Amount of pixels that show my desktop: 0

I am honestly confused why, years ago, I spent hours searching for the perfect wallpaper on the internet. And why I spent even more hours making my own, 20 years ago.

Nowadays I usually set one I like when I install the machine and maybe change it 1-4 years later. Is this what growing up feels like? :(

If you have more than one monitor your can keep all windows fully maximized.
I never saw the point of this, or Active Desktop back in the day.

But the last three releases of Fedora and Gnome have had a sort of animated wallpaper. It's actually just an XML file that defines times and image files for each time. And it's used to darken the wallpaper when the sun sets.

I use the default one that ships with Fedora but the XML file is straightforward and it's simple to make your own.

One thing that will make me use more advanced desktop features is definitely alleviating eye strain.

In that vein, using a CLI tool to check up on Gitlab pipelines is another recent development. Switching back and forth between a dark solarized terminal and a bright Gitlab Firefox window was becoming annoying.

(I know there are lots of CSS tricks you can do in FF to force dark styles on websites but I try to keep my setup as vanilla as possible to ease its management.)

GitLab has a real dark mode in the preferences now. You need to refresh once you select it. The dark syntax highlighting preference plays well with it.

Not that there is anything wrong with a CLI workflow.

Wow, thank you! The pipeline output is still a bit bad contrast but it's so much better.
Thanks for sharing this, I've been looking for options for an active wall paper that doesn't passivly wreck my performance. I look forward to giving this a try.
This looks great! Too bad it gives me a headache.
when i see some geometric animations often in small badly encoded videos i wish i would know a repository of programs that create these in order to render them onto the background in a pixel perfect manner without wasting too much resources. but i was not able to find some yet :(
Animated backgrounds not so much, but I really miss screensavers.

Of course they make no sense these days. Still, I liked the interesting displays while my workstation was left to its own thoughts.

You can use the binaries from xscreensaver as moving backgrounds. If you execute them directly they'll write to the root window.

Example:

   $ /usr/lib/xscreensaver/moire2 -root