swaywm / swaybg

Wallpaper tool for Wayland compositors
MIT License
491 stars 31 forks source link

swaybg can't open image formats #10

Closed tidux closed 4 years ago

tidux commented 5 years ago

This is reproducible on git master on an Arch Linux system with gdk-pixbuf2 installed. The build fails outright with -Werror at an error about gdk-pixbuf headers, possibly indicating a change in gdk-pixbuf. Disabling -Werror results in the following issue:

  1. Sway starts with gray no-wallpaper-found background.
  2. Upon exit, the following message is found on stderr: [background-image.c:30] Failed to load background image (Couldn't recognize the image file format for file "/path/to/background.png"). [main.c:438] Failed to load image: /path/to/background.png

This has been reproduced with both jpg and png wallpapers, which Sway normally supports.

tidux commented 5 years ago

An older build of sway 1.1-rc1 on another Arch machine with the same version of gdk-pixbuf2 installed does not have this issue so it appears to be a recent regression.

tidux commented 4 years ago

This appears to be fixed now. Rebuilding wlroots, sway, and swaybg from source resolved the issue. Possibly an Arch packaging issue with dependencies given that it appeared on one Arch machine and not another.

uninhm commented 3 years ago
2020-10-28 17:16:32 - [swaybg-1.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “.config/awesome/mountains_wallpaper.jpg”).
2020-10-28 17:16:32 - [swaybg-1.0/main.c:438] Failed to load image: .config/awesome/mountains_wallpaper.jpg
2020-10-28 17:16:32 - 

I get that error for *.jpg

matt-snider commented 3 years ago

@uninhm Were you able to find a solution? Getting the same issue using swaylock with --image /path/to/some.svg (sway/swaylock 1.5 and swaybg 1.0).

The strange thing is that manually locking via a bindsym key works fine, and the image is shown, but when swaylock is triggered via a swayidle event, the error occurs and the image is not shown.

My swayidle command:

exec swayidle -w \
  timeout 300  'swaylock -f' \
  timeout 600 'swaymsg "output * dpms off"' \
    resume 'swaymsg "output * dpms on"' \
  timeout 1200 'systemctl hibernate' \
  before-sleep 'swaylock -f' \
  resume-sleep 'swaymsg "output * dpms on"'
sethidden commented 3 years ago

See https://bbs.archlinux.org/viewtopic.php?pid=1940215#p1940215

  1. pacman -Qkk | grep mime
  2. There were some /usr/share/mime Permissions mismatch errors.
  3. sudo chmod -R uga+x /usr/share/mime
  4. pacman -Qkk | grep mime
  5. /usr/share/mime permission mismatch errors no longer there
  6. In terminal: pkill -fe sway
  7. In terminal: sway
  8. Background now shows up

This also fixed a problem with wofi --show run for me. I'll paste the error below for search engines:

broken wofi --show run [artur@t430 ~]$ wofi --show run (wofi:28741): Gtk-WARNING **: 18:16:24.976: Could not load a pixbuf from icon theme. This may indicate that pixbuf loaders or the mime database could not be found. ** Gtk:ERROR:../gtk/gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Adwaita/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3) Bail out! Gtk:ERROR:../gtk/gtk/gtkiconhelper.c:494:ensure_surface_for_gicon: assertion failed (error == NULL): Failed to load /usr/share/icons/Adwaita/16x16/status/image-missing.png: Unrecognized image file format (gdk-pixbuf-error-quark, 3) Aborted (core dumped)