diff --git a/CHANGELOG.md b/CHANGELOG.md index 30ef67458..ee7b81316 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # 1.11.2 +Features: +* Support xonsh detection (TerminalShell) + Bugfixes: * Fix flatpak package count (#441) * Don't print white color blocks with `--pipe` (#450) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 2c732b25d..6644b41b8 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -136,6 +136,11 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version) return getExeVersionGeneral(exe, version); //tcsh 6.24.07 (Astron) 2022-12-21 (aarch64-apple-darwin) options wide,nls,dl,al,kan,sm,rh,color,filec if(strcasecmp(exeName, "nu") == 0) return getExeVersionRaw(exe, version); //0.73.0 + if(strcasecmp(exeName, "python") == 0 && getenv("XONSH_VERSION")) + { + ffStrbufSetS(version, getenv("XONSH_VERSION")); + return true; + } #ifdef _WIN32 if(strcasecmp(exeName, "powershell") == 0 || strcasecmp(exeName, "powershell_ise") == 0) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 8db9f2901..d8585488b 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -148,7 +148,7 @@ static void getTerminalShell(FFTerminalShellResult* result, pid_t pid) } //Known shells - if( + if ( strcasecmp(name, "bash") == 0 || strcasecmp(name, "zsh") == 0 || strcasecmp(name, "ksh") == 0 || @@ -158,7 +158,8 @@ static void getTerminalShell(FFTerminalShellResult* result, pid_t pid) strcasecmp(name, "dash") == 0 || strcasecmp(name, "pwsh") == 0 || strcasecmp(name, "nu") == 0 || - strcasecmp(name, "git-shell") == 0 + strcasecmp(name, "git-shell") == 0 || + (strcasecmp(name, "python") == 0 && getenv("XONSH_VERSION")) ) { if (result->shellProcessName.length == 0) { @@ -369,6 +370,8 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance) ffStrbufInitS(&result.shellPrettyName, "PowerShell"); else if(ffStrbufEqualS(&result.shellProcessName, "nu")) ffStrbufInitS(&result.shellPrettyName, "nushell"); + else if(ffStrbufIgnCaseEqualS(&result.shellProcessName, "python") && getenv("XONSH_VERSION")) + ffStrbufInitS(&result.shellPrettyName, "xonsh"); else { // https://github.com/LinusDierheimer/fastfetch/discussions/280#discussioncomment-3831734