From 78dd61e73bd2e8a690a01b191174bffcbbe8b324 Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Thu, 7 Jul 2022 18:55:13 +0500 Subject: [PATCH] Add forcekittyanim option --- doc/ctpv.1 | 7 +++++++ sh/helpers.sh | 1 + src/config.c | 1 + src/ctpv.h | 2 +- src/shell.c | 3 ++- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/ctpv.1 b/doc/ctpv.1 index f1c34d1..5bf0227 100644 --- a/doc/ctpv.1 +++ b/doc/ctpv.1 @@ -270,6 +270,13 @@ Always use terminal's built-in method of previewing images. . .TP +.B forcekittyanim +Always use +.I Kitty +terminal's built-in method of previewing images for animated +images. +. +.TP .B forcechafa Always use .I Chafa diff --git a/sh/helpers.sh b/sh/helpers.sh index 79e6335..9f610e5 100644 --- a/sh/helpers.sh +++ b/sh/helpers.sh @@ -32,6 +32,7 @@ set_image_method() { image_method= [ -n "$forcekitty" ] && is_kitty && { image_method="$image_method_kitty"; return 0; } + [ -n "$forcekittyanim" ] && is_kitty && is_anim_image && { image_method="$image_method_kitty"; return 0; } [ -n "$forcechafa" ] && exists chafa && { image_method="$image_method_chafa"; return 0; } [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && exists ueberzug && diff --git a/src/config.c b/src/config.c index e8f7312..34176c0 100644 --- a/src/config.c +++ b/src/config.c @@ -47,6 +47,7 @@ static VectorPreview *previews; static struct Option options[] = { DEF_OPTION_BOOL(forcekitty), + DEF_OPTION_BOOL(forcekittyanim), DEF_OPTION_BOOL(forcechafa), DEF_OPTION_BOOL(noimages), DEF_OPTION_BOOL(nosymlinkinfo), diff --git a/src/ctpv.h b/src/ctpv.h index 110428e..8e87e7b 100644 --- a/src/ctpv.h +++ b/src/ctpv.h @@ -14,7 +14,7 @@ struct CTPV { } mode; char *server_id_s; struct { - int forcekitty, forcechafa, noimages, nosymlinkinfo; + int forcekitty, forcekittyanim, forcechafa, noimages, nosymlinkinfo; } opts; }; diff --git a/src/shell.c b/src/shell.c index c460faf..4bebdf0 100644 --- a/src/shell.c +++ b/src/shell.c @@ -37,8 +37,9 @@ static char *prepend_helpers(char *str, size_t len) int run_script(char *script, size_t script_len, int *exitcode, int *signal, SpawnProg sp, void *sp_arg) { - OPT_SETENV(forcechafa); OPT_SETENV(forcekitty); + OPT_SETENV(forcekittyanim); + OPT_SETENV(forcechafa); OPT_SETENV(noimages); OPT_SETENV(nosymlinkinfo);