artemsen / swayimg

Image viewer for Wayland
MIT License
379 stars 31 forks source link

Bug with skip_file behaviour when the loop is disabled ? #180

Closed bvergnaud closed 3 months ago

bvergnaud commented 3 months ago

Hello,

Recently discovered the project and I love the very wide support of formats. It's easily replacing imv that I used until now. Great job and thank you for your work ! :)

That being said, I'm seeing a behaviour that I find strange, and I'm not sure if it's intentional or not. Here's an extract of my configuration:

[list]
loop = no

[keys.viewer]
Delete = skip_file
Ctrl+Delete = exec rm -v "%" ; skip_file

[keys.gallery]
Delete = skip_file
Ctrl+Delete = exec rm -v "%" ; skip_file

Assuming I open swayimg on a directory with a bunch of images, when I go to the last file of the list in gallery mode and press Delete, the file is removed from the list and the "cursor" jumps back to the previous file. If I do the same thing in viewer mode, swayimg closes, with the message No more images, exit. Which is both correct and incorrect, there are no more images after that, but my current list is not empty.

One of the workflows I try to implement is manual filtering of a directory of images.

  1. Start the app over a directory.
  2. Loop through all images and "Delete" (skip_file) any image I want to keep.
  3. Once I've looped through, "Ctrl+Delete" (exec rm -v "%" ; skip_file) everything else to actually delete all the remaining files.

Disabling looping is very neat to avoid having to keep track of where you are in the list with the info overlay. But if I want to keep the last file of the list, when I "Delete" the app closes and I have to start over.

Currently, I work around the issue by enabling the loop. But It'd be great if we could have the same behaviour as the gallery mode in the viewer mode (jump back to the last image still available in the list, close only if there are no more images).

❯ swayimg --version
swayimg version 3.1.
https://github.com/artemsen/swayimg
Supported formats: bmp, pnm, tga, jpeg, png, gif, webp, svg, heif, avif, avifs, jxl, exr, tiff.

Cheers.

artemsen commented 3 months ago

Great job and thank you for your work ! :)

Thank you!

But It'd be great if we could have the same behaviour as the gallery mode in the viewer mode (jump back to the last image still available in the list, close only if there are no more images)

Fixed.