swaywm / swaybg

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

gdk-pixbuf fails to recognize image files when $XDG_DATA_DIR is set #55

Closed ethanalker closed 1 year ago

ethanalker commented 1 year ago

Sway gives the following errors when trying to load the background image for both the default .png and the .jpg that I tested:

2023-01-19 00:40:28 - [swaybg-1.2.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png”).
2023-01-19 00:40:28 - [swaybg-1.2.0/main.c:621] Failed to load image: /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
2023-01-19 00:40:28 - [swaybg-1.2.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png”).
2023-01-19 00:40:28 - [swaybg-1.2.0/main.c:621] Failed to load image: /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
2023-01-19 00:40:28 - [swaybg-1.2.0/background-image.c:30] Failed to load background image (Couldn’t recognize the image file format for file “/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png”).
2023-01-19 00:40:28 - [swaybg-1.2.0/main.c:621] Failed to load image: /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png

Here is sway reading my wallpaper config:

00:00:00.253 [DEBUG] [sway/config.c:832] Read line 24: 
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 25: ### Output configuration
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 26: #
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 27: # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
00:00:00.253 [DEBUG] [sway/config.c:832] Read line 28: output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [INFO] [sway/commands.c:380] Config command: output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [INFO] [sway/commands.c:400] After replacement: output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [DEBUG] [sway/commands.c:432] Subcommand: bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
00:00:00.253 [DEBUG] [sway/config/output.c:236] Adding output * config
00:00:00.253 [DEBUG] [sway/config/output.c:240] Config stored for output * (enabled: -1) (-1x-1@-1.000000Hz position -1,-1 scale -1.000000 subpixel unknown transform -1) (bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill) (power -1) (max render time: -1)
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[0] = swaybg
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[1] = -o
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[2] = *
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[3] = -i
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[4] = /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[5] = -m
00:00:00.253 [DEBUG] [sway/config/output.c:889] spawn_swaybg cmd[6] = fill
00:00:00.255 [DEBUG] [sway/config.c:832] Read line 29: #output * bg /home/ealker/.config/sway/sun-bg.jpg fill
00:00:00.255 [DEBUG] [sway/config.c:832] Read line 30: 

The logs looked the same when I tried it with my .jpg background.

Swaybg worked perfectly for as long as I've been using sway, but I let my battery die and after charging and restarting it had a gray background. Here the rest of the debug log file: sway.log

I am running arch linux on a Lenovo Legion 5 Pro with a Ryzen 7 5800H and RTX 3060, but I only ever run sway with my amdgpu drivers, and the issue persists after completely disabling my nvidia driver with udev rules (it is not listed is lspci).

I think it may have something to do with this line:

00:00:00.253 [DEBUG] [sway/config/output.c:240] Config stored for output * (enabled: -1) (-1x-1@-1.000000Hz position -1,-1 scale -1.000000 subpixel unknown transform -1) (bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill) (power -1) (max render time: -1)

But I have no idea where to start with debugging and I found very little online to help.

ethanalker commented 1 year ago

After more experimentation I found that gdk-pixbuf is also failing with the same error when opening gtk applications, but all fixes I have found online have failed to fix my issue.

ethanalker commented 1 year ago

Solved. Setting $XDG_DATA_DIRS at all seems to make gdk-pixbuf fail, found here. Had nothing to do with the fact that my battery died, I just hadn't restarted since I set it and I set it a while ago.