Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mail-b.sr.ht (Postfix) with ESMTPS id E1E5D11EF55 for <~exec64/imv-devel@lists.sr.ht>; Mon, 30 May 2022 11:56:56 +0000 (UTC) Received: by mail-lf1-f54.google.com with SMTP id bf44so803409lfb.0 for <~exec64/imv-devel@lists.sr.ht>; Mon, 30 May 2022 04:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JZklJMairEJBpITFPHF9oQ0J5Vwf0NqF8ZHqiJ8zxAA=; b=k/OTz0X7/P80JMKjoEOUe9L73xxkBp862swC0T9LwwFFQCyB/nS82TpiPs8+uju5tc 9kraqVEpc846Yu+0ucM2H75TfYvk8gRp3cLJL3cIpS3X/eJkKb55cO4aszGwN/gtu4Sz +/kHZtv4Y3mD6zHtb3ha5EPAywCwuyofxU1VJnW8IzXAgZ0f6L29Y8IsLinswWw/xxUQ +ZGN2WtSKXXbRh1lqBZ/MIEvFMeDUYu4VTOuzaqENwtrUeU14UzuUdSVT0BLNPsigYl0 OIL0uM73rFZ8z8QkGsWZmOhUhAc2og0CFziYcH+MWUcFhJBgpEvBG7DFlPEycWc1hvo7 viJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=JZklJMairEJBpITFPHF9oQ0J5Vwf0NqF8ZHqiJ8zxAA=; b=HaLlef2gYybT3nL9XZp3YS7onfM9oafBLDkd+23T9MwEcU+i04RdhjTjHPosjmaoF+ lQR7hs/udBZqKRFh0EQDPN5qZlUsMt3pE/0AegdsgYK4mPx9K/XaAXSOoIwwalOXnDUe N37JSyWznVFMjqKD2t4V+XW+CYpTcxT16b9PhwZYhygr2eoLlyWaM8kWMCeqgCXp9B6/ GsGD5RdOF+RK+CnigXGhCpkTcxHFYaekFsGaTdnV1GWXPfP2yM+fH2h093xLkyG7O3nX FzXSlybF5h9MkmaNBn/WfQX5BtUj3PTVLW4vd3hFcloGylfxPSBwX1izLIZ92406ivuH UOJg== X-Gm-Message-State: AOAM53036534Uzh7RtYtQntUSbl79S/1mrz5fZtzeDVlDF1hwoJOqHhX l7lsnjRzNHdmZMh/FiD+L/snOOmWof3iVxO0 X-Google-Smtp-Source: ABdhPJzEZoOCSNxECGzFTeB2bU5dxwEJYr+Xy8bu+VXy9eWsJZkxSelixfBEwiSGaD2uHeK551hNwQ== X-Received: by 2002:a05:6512:2306:b0:477:cb31:d9d1 with SMTP id o6-20020a056512230600b00477cb31d9d1mr38283038lfu.183.1653911815336; Mon, 30 May 2022 04:56:55 -0700 (PDT) Received: from localhost.localdomain ([81.9.126.169]) by smtp.gmail.com with ESMTPSA id o11-20020ac25e2b000000b0047867f0b7basm2272508lfg.154.2022.05.30.04.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 May 2022 04:56:54 -0700 (PDT) From: Ivan Oleynikov To: ~exec64/imv-devel@lists.sr.ht Cc: Ivan Oleynikov Subject: [PATCH imv] Make imv-dir act like imv when called with multiple arguments Date: Mon, 30 May 2022 14:56:29 +0300 Message-Id: <20220530115629.14694-1-ivan.oleynikov95@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 @@ -#!/bin/sh -exec imv -n "$1" "$(dirname "$1")" +#!/bin/sh -efu +if [ $# -ge 2 ]; then + exec imv "$@" +else + exec imv -n "$1" "$(dirname "$1")" +fi 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 NoDisplay=true Terminal=false Type=Application -- 2.36.1