Logo: disable image logos in ssh and tmux sessions

This commit is contained in:
李通洲 2024-05-03 01:08:14 +08:00 committed by 李通洲
parent ef3b5df048
commit 71cba2451a

View File

@ -1,6 +1,7 @@
#include "image.h"
#include "common/io/io.h"
#include "common/printing.h"
#include "util/stringUtils.h"
#include <limits.h>
#include <math.h>
@ -839,6 +840,22 @@ bool ffLogoPrintImageIfExists(FFLogoType type, bool printError)
return false;
}
if (getenv("SSH_TTY"))
{
if(printError)
fputs("Logo: Image logo is not supported in SSH sessions\n", stderr);
return false;
}
const char* term = getenv("TERM");
if((term && ffStrEquals(term, "screen")) || getenv("ZELLIJ") || getenv("TMUX"))
{
if(printError)
fputs("Logo: Image logo is not supported in terminal multiplexers\n", stderr);
return false;
}
if(type == FF_LOGO_TYPE_IMAGE_ITERM)
return printImageIterm();