Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swaybg fails to render webp: Couldn’t recognize the image file format #321983

Open
KiaraGrouwstra opened this issue Jun 23, 2024 · 4 comments
Open
Labels
0.kind: bug Something is broken

Comments

@KiaraGrouwstra
Copy link
Contributor

Describe the bug

as per swaywm/swaybg#76, webp images seem rejected by swaybg under NixOS.

Steps To Reproduce

Steps to reproduce the behavior:

  1. install swaybg and webp-pixbuf-loader
  2. swaybg -i img.webp
  3. find error: [background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “img.webp”).

Expected behavior

any image formats supported by swaybg work

Additional context

this may be about gdk-pixbuf detecting webp-pixbuf-loader, tho its package does do stuff about this (and confirmed on my end, libpixbufloader-webp.so is present in /run/current-system/sw/lib/gdk-pixbuf-2.0/2.10.0/loaders/ and /etc/profiles/per-user/kiara/lib/gdk-pixbuf-2.0/2.10.0/loaders/).

c.f. #221017 similarly mentions webp issues in gdk-pixbuf, tho using librsvg

Notify maintainers

@primeos
@bobby285271
@hedning
@jtojnar
@dasj19
@cwyc

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.2-zen1, NixOS, 24.11 (Vicuña), 24.11.20240525.47e03a6`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Lix, like Nix) 2.90.0-beta.1-lixpre20240506-b6799ab`
 - nixpkgs: `/run/current-system/nixpkgs`
@KiaraGrouwstra KiaraGrouwstra added the 0.kind: bug Something is broken label Jun 23, 2024
@jtojnar
Copy link
Member

jtojnar commented Jun 23, 2024

Programs generally do not load stuff from /run/current-system/sw/lib – otherwise, we could return to just using /usr/lib. In this case, you need to add webp-pixbuf-loader to swaybg package using a wrapper that sets GDK_PIXBUF_MODULE_FILE environment variable. See eog for an example:

postInstall = ''
# Pull in WebP and JXL support for gnome-backgrounds.
# In postInstall to run before gappsWrapperArgsHook.
export GDK_PIXBUF_MODULE_FILE="${gnome._gdkPixbufCacheBuilder_DO_NOT_USE {
extraLoaders = [
libjxl
librsvg
webp-pixbuf-loader
libheif.out
];
}}"
'';

Also please always open an issue downstream (in Nixpkgs) before going upstream, unless you are sure it is an upstream issue.

@KiaraGrouwstra
Copy link
Contributor Author

i tested creating a local overlay adding a similar attribute:

prev.swaybg.overrideAttrs (oa: {
  postInstall = ''
    # Pull in WebP and JXL support
    export GDK_PIXBUF_MODULE_FILE="${pkgs.gnome._gdkPixbufCacheBuilder_DO_NOT_USE {
      extraLoaders = [
        pkgs.libjxl
        pkgs.librsvg
        pkgs.webp-pixbuf-loader
        pkgs.libheif.out
      ];
    }}"
  '';
})

it looks like this did not resolve the issue yet however.

@jtojnar
Copy link
Member

jtojnar commented Jun 23, 2024

That's just one part. You also need the wrapper.

KiaraGrouwstra added a commit to KiaraGrouwstra/nixpkgs that referenced this issue Jun 24, 2024
donovanglover added a commit to donovanglover/nixpkgs that referenced this issue Jul 9, 2024
Fixes "Tuba-WARNING: Image.vala:68: Failed to download image at
"https://example.com/avatar.webp": Unrecognized image file format"

Useful for Misskey instances using webp avatars by default.

See: GeopJr/Tuba#708
And: NixOS#321983
@Atemu
Copy link
Member

Atemu commented Nov 11, 2024

Sorry, when was this completed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants