Add chafasixel option

This commit is contained in:
Nikita Ivanov 2023-03-21 19:05:03 +01:00
parent df6a273505
commit f1f649fd9c
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
4 changed files with 11 additions and 3 deletions

View File

@ -19,7 +19,11 @@ noimages() {
}
autochafa() {
[ -z "$autochafa" ]
[ -n "$autochafa" ]
}
chafasixel() {
[ -n "$chafasixel" ]
}
is_kitty() {
@ -67,7 +71,9 @@ is_anim_image() {
}
chafa_run() {
autochafa && format='-f symbols' || format=
format='-f symbols'
autochafa && format=
chafasixel && format='-f sixels'
chafa -s "${w}x${h}" $format "$1" | sed 's/#/\n#/g'
}

View File

@ -63,6 +63,7 @@ static struct Option options[] = {
DEF_OPTION_BOOL(noimages),
DEF_OPTION_BOOL(nosymlinkinfo),
DEF_OPTION_BOOL(autochafa),
DEF_OPTION_BOOL(chafasixel),
DEF_OPTION_BOOL(showgpg),
DEF_OPTION_STR(shell),
};

View File

@ -16,7 +16,7 @@ struct CTPV {
char *server_id_s;
struct {
int forcekitty, forcekittyanim, forcechafa, noimages, nosymlinkinfo;
int autochafa, showgpg;
int autochafa, chafasixel, showgpg;
char *shell;
} opts;
};

View File

@ -46,6 +46,7 @@ RESULT run_script(char *script, size_t script_len, int *exitcode, int *signal,
OPT_SETENV_INT(noimages);
OPT_SETENV_INT(nosymlinkinfo);
OPT_SETENV_INT(autochafa);
OPT_SETENV_INT(chafasixel);
OPT_SETENV_INT(showgpg);
OPT_SETENV_STR(shell);