Rust Wayland No transparency

I have an overlay app written in rust. It uses wayland (Speedy2D/winit) to create click-through transparent window. I’ve built it on Arch (Manjaro KDE) and it worked flawlessly. But when I tried to build it on NixOS (Gnome, WINIT_UNIX_BACKEND set to wayland) it shows up black instead of transparent.
Source code, if it helps: GitHub - InfiniteCoder01/chatry

Transparency is calculated by the specific Wayland compositor, and not all of them support it properly. GNOME should, however - maybe there is something amiss in the way GNOME is packaged in nixpkgs, or there is something overriding the compositor in your NixOS configuration.

I tried to run it with X11, but I couldn’t disable mouse pass-through (?).
I found an old issue on github talking about transparency: No Background Transparency Under GNOME Shell · Issue #8 · esmil/stupidterm · GitHub
My nix configuration (mostly with home manager): GitHub - InfiniteCoder01/InfiniteCoder01: Config files for my GitHub profile.
In my nix config, I do nothing about wayland, but I heard gnome prefers it and my XDG_SESSION_TYPE is in fact wayland.

I’ve fixed it by removing this weird line: helper.set_fullscreen_mode(WindowFullscreenMode::FullscreenBorderless);
I added it when I was on Manjaro because of some weired fullscreen bug.

Glad to hear that, and thanks for posting the fix here for others in the same predicament (unlikely, but all the more valuable for that reason :D)

can I expand this question a bit, not to create a very similar sounding new topic?

I’m trying to use winit and just get Failed to initialize Wayland backend: NoWaylandLib, both with WINIT_UNIX_BACKEND=wayland and with WINIT_UNIX_BACKEND=x11

how do you make it work at all?

You need a library. Before, I’ve used nix shell like this one: (Swap wayland with commented Xorg libraries to switch to X, winit will detect the change automatically). Now I use flakes, but I haven’t done devshell with those libraries yet.

1 Like

oh thank you! that moved me somewhere

though with populating LD_LIBRARY_PATH with the same libs from your example i get this error instead Error: AdapterNotFound (correction - this error is caused by code unrelated to winit, winit itself now works fine, thank you again)

also using LD_LIBRARY_PATH does seem like a hack, I wonder if there is a “proper”-er way