xyproto / wallutils

:city_sunset: Utilities for handling monitors, resolutions, wallpapers and timed wallpapers
BSD 3-Clause "New" or "Revised" License
463 stars 17 forks source link

settimed fails to set transition wallapaper #7

Closed yegorius closed 4 years ago

yegorius commented 5 years ago

settimed correctly sets wallpaper during the launch, but crashes in the next 20 minutes or so:

Crossfading between images.
Window: 20m
Cooldown: 2m
Loop wait: 5s
Transition type: overlay
From filename /usr/share/backgrounds/gnome/mojave/mojave_dynamic-1000.jpg
To filename /usr/share/backgrounds/gnome/mojave/mojave_dynamic-1100.jpg
Crossfading between images.
Setting /tmp/gnometimed_crossfade.png.
Using the Feh backend.
feh --bg-scale /tmp/gnometimed_crossfade.png
Setting /tmp/gnometimed_crossfade.png.
Using the Feh backend.
feh --bg-scale /tmp/gnometimed_crossfade.png
failed: feh --bg-scale /tmp/gnometimed_crossfade.png failed to run
Using the X11 backend.
convert /tmp/gnometimed_crossfade.png /tmp/_setwallpaper.xbm
failed: feh --bg-scale /tmp/gnometimed_crossfade.png failed to run
Using the X11 backend.
convert /tmp/gnometimed_crossfade.png /tmp/_setwallpaper.xbm
Setting /tmp/gnometimed_crossfade.png.
Using the Feh backend.
feh --bg-scale /tmp/gnometimed_crossfade.png
failed: feh --bg-scale /tmp/gnometimed_crossfade.png failed to run
Using the X11 backend.
convert /tmp/gnometimed_crossfade.png /tmp/_setwallpaper.xbm
malloc(): unsorted double linked list corrupted
SIGABRT: abort
...

If I then try to run feh on /tmp/gnometimed_crossfade.png:

feh --bg-scale /tmp/gnometimed_crossfade.png 
libpng error: bad adaptive filter value
feh WARNING: /tmp/gnometimed_crossfade.png - No Imlib2 loader for that file format
feh ERROR: Unable to load image /tmp/gnometimed_crossfade.png

OS: Arch Linux WM: i3

xyproto commented 5 years ago

Thanks for reporting! I will look into this. The X11 backend is the most fragile of all the available backend. It was surprising to me that the feh backend failed with the cross fade image. I will fix this.

xyproto commented 5 years ago

I implemented support for writing the XBM and XPM image file formats, as steps in solving this issue:

My next plan is to write directly to xpm and and skip using feh.

xyproto commented 5 years ago

I added functionality to x11.go and xwallpaper.h for setting XPM images as the background image, for X11, instead of using feh or the XBM format. This could be improved further by not writing to a temporary file and setting the image data directly through the X11-related C-functions.

However, images with too many colors may still be an issue.

I also need to test this new functionality a bit more.

xyproto commented 4 years ago

I created the palgen package and made some changes to the xpm. It can now reduce the number of colors when converting images to .xpm. It could probably be both faster and more robust, but it should remove the issue of images having too many colors when setting .xpm images as wallpapers.

Please test the latest master of wallutils and see if the issue has now been resolved.

I'm also planning to do some more testing on various window managers for X.

xyproto commented 4 years ago

I just tested with i3, and it works best with the feh method. I'm also on Arch Linux.

Since your installation says:

feh WARNING: /tmp/gnometimed_crossfade.png - No Imlib2 loader for that file format
feh ERROR: Unable to load image /tmp/gnometimed_crossfade.png

Perhaps your installation of imlib2 has been compiled without support for PNG files?

Could you please try reinstalling feh and/or imlib2, or possibly install any missing packages that could be related?

xyproto commented 4 years ago

After looking into this error: libpng error: bad adaptive filter value, I think there may be something wrong with the png image itself, possibly a concurrency issue, if the writing of the png image was aborted somehow.

I will try to reproduce the error by running the same command as you did.

yegorius commented 4 years ago

I have the latest version of feh and imlib2 from Arch and imlib2 is compiled with png support. Anyway, here is the fresh log output

xyproto commented 4 years ago

Thanks for the log output! I looked into this, and there is something wrong with the function that performs the cross-fade between two images, in relation to concurrency, resulting in half-written images. I will fix this.

xyproto commented 4 years ago

I have made several changes related to the cross-fade functionality.

Please test the latest master and see if it fixes this issue. Thanks!

xyproto commented 4 years ago

Now there are other issues. The Mojave wallpaper events are not correct. I'll have to look into this as well. But this issue might be fixed.

xyproto commented 4 years ago

I think this bug is fixed. However, issue #9 remains. Please re-open if there should be further issues with this.