From 4bd4ec28974a9cbfc6aab2d3bd211de663b9f7da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 2 Mar 2024 18:32:31 +0800 Subject: [PATCH] Terminal (Linux): detect zellij version --- src/detection/terminalshell/terminalshell.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 9d645356a..8fc56d34b 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -437,6 +437,15 @@ static bool getTerminalVersionTmux(FFstrbuf* exe, FFstrbuf* version) return version->length > 0; } +static bool getTerminalVersionZellij(FFstrbuf* exe, FFstrbuf* version) +{ + if(!getExeVersionRaw(exe, version)) return false; + + // zellij 0.39.2 + ffStrbufSubstrAfterFirstC(version, ' '); + return version->length > 0; +} + #ifdef _WIN32 static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version) @@ -554,6 +563,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufStartsWithIgnCaseS(processName, "screen")) return getTerminalVersionScreen(exe, version); + if(ffStrbufStartsWithIgnCaseS(processName, "zellij")) + return getTerminalVersionZellij(exe, version); + const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION"); if(termProgramVersion) {