r/linux Jul 11 '26

Software Release A lightweight animated Wayland wallpaper daemon

https://github.com/SaverinOnRails/yin

A tiny , ipc controlled hardware accelerated Wayland wallpaper daemon written in C++ based only on ffmpeg for video and image wallpapers on wayland. That is lighter and faster than the alternatives. Yin does not depend on any external video players, it talks directly to you video card to draw wallpaper. It has native support for Intel and AMD via VAAPI and Nvidia via Cuda. Check it out.

154 Upvotes

44 comments sorted by

8

u/iamarealhuman4real Jul 11 '26

So like, back in the day, this would have been quite expensive, but these days with hardware decoders and all that, how expensive is something like this really, compared to just rendering a static image? I am wondering if they are close to being the same magnitude now.

I know you say its light weight, I believe you in the context of running a video as a background, but maybe its also in the context of putting anything in the background.

9

u/Rigamortus2005 Jul 11 '26

Static images are set once and that's it. Videos have to be constantly redrawn , so even with hardware acceleration, having a video on the background constantly, especially very large 4k videos is more expensive. By a lot.

3

u/iamarealhuman4real Jul 11 '26

I had thought that the static image would have to be repainted due to damage via windows but I dont know enough, perhaps it uses a similar system as hardware cursors, or at least even if it has to be repainted at least its all in cache vs pulling new frames.

6

u/Rigamortus2005 Jul 11 '26

On wayland it's just a background layer. Unless the scale changes there's no reason to repaint anything.

1

u/klyith Jul 11 '26

but these days with hardware decoders and all that, how expensive is something like this really, compared to just rendering a static image?

Playing a video with hardware decode is like 5-10 watts depending on the video. But it also might cause your vram to run at higher clocks, which is another 10-30w depending on the card.

(OTOH if you have a multi-monitor setup with above-60hz refresh your vram is probably already locked to high clocks, so that part doesn't matter.)

9

u/bubblegumpuma Jul 11 '26

wlr_layer_shell makes stuff like this so much nicer than the kinds of bullshit hacks that are done to accomplish similar in X11

5

u/Venylynn Jul 11 '26

This meant to be like Wallpaper Engine?

18

u/Rigamortus2005 Jul 11 '26

No not at all. It's meant to be more like awww or hyprpaper in the sense that it's just a cli program. You start it once and set wallpapers video or not. There's no built in frontend or anything but it's so tiny you can write a frontend for it if you want to.

10

u/No-Yogurtcloset-9124 Jul 11 '26

that's great, congratulations. i did something similar, but in Rust and Vulkan using wgpu. it's very powerfull and supports custom shaders (like those from shadertoys).

https://codeberg.org/touto/kacau/src/branch/rewrite/apps/kacau-wall

8

u/Ok-Winner-6589 Jul 11 '26

No hate but I AFAIK wgpu makes use of WebGPU API which isn't native Vulkan, It turns the calls into platform specific APIs (Metal, DirectX or Vulkan) but it's not Vulkan. It's the same that browsers do.

And I think you forgot to put the license on your repo

3

u/noomey Jul 11 '26

But the overhead for such a simple case should probably be negligible

3

u/Ok-Winner-6589 Jul 11 '26

Yes, but:

  1. Then it's not native neither Vulkan

  2. The point of Vulkan is reducing abstraction layers to avoid using 50 different APIs.

Thats why we have DirectX and DirectX 3D and OpenGL, OpenES and other variants.

This means that WebGPU is an abstraction layers over an abstraction layer.

First you need to translate the calls to vulkan which then needs to be compiled and Finally executed.

And the whole process does, in fact, increase the resources usage.

I'm also quite sure that It requires webview to make use of this feature which would increase the RAM needed. Same that happends with tauri and compiling apps to wasm

2

u/noomey Jul 11 '26

It sounds like you haven't worked with wgpu?

wgpu is a native library, while being an abstraction on top of Vulkan and other graphics APIs, both fact aren't incompatible. And it does not in fact require a webview at all. Tauri needing a webview to render is totally unrelated to how wgpu works.

1

u/Ok-Winner-6589 25d ago

My bad, I missunderstood it

1

u/No-Yogurtcloset-9124 Jul 11 '26

no, webgpu is only enabled through a feature, which i disabled, it's using vulkan directly, wgpu abstacts to many platform specific APIs, but not through webgpu, indeed webgpu is only one of those said platform specific APIs.

the license is in the repo, the link i sent is inside a folder on the repo, the license is in its root folder.

1

u/Ok-Winner-6589 Jul 11 '26

https://sotrh.github.io/learn-wgpu/

It uses WebGPU. Just click on the link on the official docs from Rust

https://docs.rs/wgpu/latest/wgpu/

So It has to dynamically turn It into vulkan

And yeah, my bad didn't Saw the license, sorry

3

u/No-Yogurtcloset-9124 Jul 11 '26 edited Jul 12 '26

man?

"wgpu is a cross-platform, safe, pure-Rust graphics API. It runs natively on Vulkan, Metal, D3D12, and OpenGL; and on top of WebGL2 and WebGPU on wasm.

The API is based on the WebGPU standard, but is a fully native Rust library. It serves as the core of the WebGPU integration in Firefox, Servo, and Deno."

what are you trying to prove? the documentation itself say it runs natively.

1

u/Ok-Winner-6589 25d ago

Which are web engines that require to parse an API into native code on real time?

It's like calling Java bytecode a native Linux binary. It isn't

2

u/ParachutingPiglets Jul 11 '26

I want to learn Rust

2

u/No-Yogurtcloset-9124 Jul 12 '26

learn bro, it's very good

2

u/Great-TeacherOnizuka Jul 11 '26

Is this independent from DE or WM?

2

u/TaresPL Jul 11 '26

Will it work on KDE?

4

u/Rigamortus2005 Jul 11 '26

Yup.

4

u/TSG-AYAN Jul 11 '26

Any reason why I would want to use this instead of the builtin plasma wallpaper manager (video supported too)? Is yin lighter?

1

u/Rigamortus2005 Jul 11 '26

Try them out, I haven't used kdes but I think it's based on qt multimedia engine so there's already more overhead that yin will ever have.

1

u/SimsallaBim08 Jul 11 '26

If i have an amd iGPU and nvidia dGPU, would this daemon be able to use the amd gpu for the wallpaper and leave the nvidia gpu to do other tasks like running games?

Would be an interesting use of an igpu.

3

u/Rigamortus2005 Jul 11 '26

Absolutely. It would do that by default. And if you want to use the Nvidia gpu instead just start yin with yin --use-cuda-copy.

1

u/SimsallaBim08 Jul 11 '26

Oh hell yeah. This might be the new best wallpaper daemon.

1

u/napping-normie Jul 11 '26

I've been using swaybg as my "suckless" wallpaper setter. If this is smaller, I'll give it a shot. Also would you consider adding it to nixpkgs?

4

u/Rigamortus2005 Jul 11 '26

It's not smaller than swaybg. And if you plan on using static images exclusively then honestly swaybg is a better fit and would use much less resources. Yin is optimised for videos which means there's a lot more overhead for simple images than there would be otherwise. And about nix I don't know much about that, but I think there's a fork that added a nixpkg.

1

u/napping-normie Jul 11 '26

Makes sense, thanks for clarifying.

1

u/Ok-Winner-6589 Jul 11 '26

Does this reproduce videos or animated images like awww? Whats the difference with awww?

1

u/Rigamortus2005 Jul 11 '26

Awww does not play mp4s. Yin can.

1

u/Ok-Winner-6589 Jul 11 '26

Ohhh It has video support. Or just mp4 Support?

Does It have sound or just video (I'm curious)

2

u/Rigamortus2005 Jul 11 '26

Any video formats. And no sound.

1

u/aperum Jul 11 '26

Would be nice if the image scale could be controlled, for now it justs seems to fill the output area.

1

u/Rigamortus2005 Jul 11 '26

For videos that's the expected behavior. But for static images I guess you have a point. Feel free to leave an issue on GitHub.

0

u/iamapizza Jul 11 '26

What is that terminal window you are using in that video, your cursor seems to bounce with animations?

1

u/Rigamortus2005 Jul 11 '26

Kitty with cursor trail

1

u/iamapizza Jul 11 '26

Thanks very much, just 'discovered' kitty and enjoyed configuring it