imv: Make imv-dir act like imv when called with multiple arguments v1 PROPOSED

Ivan Oleynikov: 1
 Make imv-dir act like imv when called with multiple arguments

 2 files changed, 7 insertions(+), 3 deletions(-)
#770204 freebsd.yml success
#770205 archlinux.yml success
#770206 debian.yml success
#770207 fedora.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~exec64/imv-devel/patches/32619/mbox | git am -3
Learn more about email & git

[PATCH imv] Make imv-dir act like imv when called with multiple arguments Export this patch

This commit allows user to select a few files and open only them using
imv-dir. When user opens just one file (typically by double-clicking on
it in a file manager), imv-dir will behave like it used to and open
open the whole directory.

I think this behavior is more reasonable doesn't add much complexity to
imv-dir. Now imv-dir conveniently accomodates the three use-cases which
I think must be quite common:

1. If user wants to cycle through all files in current directory, they
   can just double click on one of them.

2. If the user wants to cycle through just a few specific files (say,
   if they have many files in this directory and don't want to see them
   all), they select them and hit Enter.

3. If the user wants to see just one file and doesn't care about cycling
   through them, they just click on one file. The cycling is available,
   but they don't have to use it.

For me, 1 and 2 were the main use-cases and to accomodate them I had to
switch between imv and imv-dir as default image viewers, which is rather
suboptimal. Now both are cheaply accomodated by imv-dir.
 contrib/imv-dir       | 8 ++++++--
 files/imv-dir.desktop | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/contrib/imv-dir b/contrib/imv-dir
index d9fb46f..b50ddcc 100755
--- a/contrib/imv-dir
+++ b/contrib/imv-dir
@@ -1,2 +1,6 @@
exec imv -n "$1" "$(dirname "$1")"
#!/bin/sh -efu
if [ $# -ge 2 ]; then
  exec imv "$@"
  exec imv -n "$1" "$(dirname "$1")"
diff --git a/files/imv-dir.desktop b/files/imv-dir.desktop
index faa408d..df2debf 100644
--- a/files/imv-dir.desktop
+++ b/files/imv-dir.desktop
@@ -4,7 +4,7 @@ Name[en_US]=imv-dir
GenericName=Image viewer
GenericName[en_US]=Image viewer
Comment=Fast freeimage-based Image Viewer | Open all images in a directory
Exec=imv-dir %f
Exec=imv-dir %F
imv/patches: SUCCESS in 1m56s

[Make imv-dir act like imv when called with multiple arguments][0] from [Ivan Oleynikov][1]

[0]: https://lists.sr.ht/~exec64/imv-devel/patches/32619
[1]: mailto:ivan.oleynikov95@gmail.com

✓ #770207 SUCCESS imv/patches/fedora.yml    https://builds.sr.ht/~exec64/job/770207
✓ #770205 SUCCESS imv/patches/archlinux.yml https://builds.sr.ht/~exec64/job/770205
✓ #770204 SUCCESS imv/patches/freebsd.yml   https://builds.sr.ht/~exec64/job/770204
✓ #770206 SUCCESS imv/patches/debian.yml    https://builds.sr.ht/~exec64/job/770206