From 3f4926cbd5f5ac77cb1d062296e91e24879c8e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 14 Oct 2022 18:51:04 +0800 Subject: [PATCH] TerminalShell: detect platform specific terminal on correct system only --- src/detection/terminalshell/terminalshell_linux.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 0e80e743a..80ace12bd 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -183,30 +183,36 @@ static void getTerminalFromEnv(FFTerminalShellResult* result) getenv("ALACRITTY_WINDOW_ID") != NULL )) term = "Alacritty"; + #ifdef __ANDROID__ //Termux if(!ffStrSet(term) && ( getenv("TERMUX_VERSION") != NULL || getenv("TERMUX_MAIN_PACKAGE_FORMAT") != NULL || getenv("TMUX_TMPDIR") != NULL )) term = "Termux"; + #endif + #ifdef __linux__ //Konsole if(!ffStrSet(term) && ( getenv("KONSOLE_VERSION") != NULL )) term = "konsole"; + #endif //MacOS, mintty if(!ffStrSet(term)) term = getenv("TERM_PROGRAM"); - //We are in WSL but not in Windows Terminal + #ifdef __linux__ if(!ffStrSet(term)) { + //We are in WSL but not in Windows Terminal const FFHostResult* host = ffDetectHost(); if(ffStrbufCompS(&host->productName, FF_HOST_PRODUCT_NAME_WSL) == 0 || ffStrbufCompS(&host->productName, FF_HOST_PRODUCT_NAME_MSYS) == 0) //TODO better WSL or MSYS detection term = "conhost"; } + #endif //Normal Terminal if(!ffStrSet(term))