إذا قمت بالنقر فوق صورة في مدير الملفات ، فإنه يفتح فقط الصورة التي تم النقر فوقها. أرغب حقًا في رؤية ميزة تحميل جميع الصور في نفس المجلد حتى أتمكن من تصفح الصور.
تم تصميم sxiv لمستخدمي سطر الأوامر. الرجاء استخدام برنامج نصي مجمّع لذلك. Google sxiv-rifle
أو استخدم ما يلي:
#!/bin/sh
if [ $# -ne 1 -o ! -f "$1" ]; then
echo "usage: ${0##*/} FILE" >&2
exit 1
fi
file -i "$(dirname "$1")"/* \
| awk -F ': *' -v f="$1" '
$2 ~ "^image" {
files[cnt++] = $1;
if ($1 == f)
n = cnt;
}
END {
for (i = 0; i < cnt; i++)
print files[i] | "sxiv -i -n " n;
}'
سيكون من الجيد أن يأخذ الخيار -n
أيضًا "اسم الملف" بدلاً من "رقم الفهرس" فقط ، مثل فتح مدير الملفات مع تحديد ملف معين. باستخدام هذا ، يمكنك استخدام شيء مثل sxiv -n x.png *.png
diff --git a/options.c b/options.c
index de02407..b9ca468 100644
--- a/options.c
+++ b/options.c
@@ -45,6 +45,7 @@ void parse_options(int argc, char **argv)
int n, opt;
char *end, *s;
const char *scalemodes = "dfwh";
+ char *opt_n = NULL; /* -n (starting picture number) can be index or filename */
progname = strrchr(argv[0], '/');
progname = progname ? progname + 1 : argv[0];
@@ -117,10 +118,7 @@ void parse_options(int argc, char **argv)
_options.from_stdin = true;
break;
case 'n':
- n = strtol(optarg, &end, 0);
- if (*end != '\0' || n <= 0)
- error(EXIT_FAILURE, 0, "Invalid argument for option -n: %s", optarg);
- _options.startnum = n - 1;
+ opt_n = optarg;
break;
case 'N':
_options.res_name = optarg;
@@ -172,6 +170,21 @@ void parse_options(int argc, char **argv)
_options.filenames = argv + optind;
_options.filecnt = argc - optind;
+ if (opt_n != NULL) {
+ for (n = 0; n < _options.filecnt; n++) {
+ if (strcmp(_options.filenames[n], opt_n) == 0)
+ break;
+ }
+ if (n < _options.filecnt) {
+ _options.startnum = n;
+ } else {
+ n = strtol(opt_n, &end, 0);
+ if (*end != '\0' || n <= 0)
+ error(EXIT_FAILURE, 0, "Invalid argument for option -n: %s", optarg);
+ _options.startnum = n - 1;
+ }
+ }
+
if (_options.filecnt == 1 && STREQ(_options.filenames[0], "-")) {
_options.filenames++;
_options.filecnt--;
تحرير: لاحظت للتو أن هناك بالفعل طلب سحب (https://github.com/muennich/sxiv/pull/371).
الحل الخاص بي لهذا:
https://github.com/Parveshdhull/misc/tree/master/linux
التعليق الأكثر فائدة
الحل الخاص بي لهذا:
https://github.com/Parveshdhull/misc/tree/master/linux