Skip to content

Commit 9c7b868

Browse files
committed
TerminalShell: support xonsh
1 parent f333937 commit 9c7b868

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 1.11.2
22

3+
Features:
4+
* Support xonsh detection (TerminalShell)
5+
36
Bugfixes:
47
* Fix flatpak package count (#441)
58
* Don't print white color blocks with `--pipe` (#450)

src/detection/terminalshell/terminalshell.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
136136
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
137137
if(strcasecmp(exeName, "nu") == 0)
138138
return getExeVersionRaw(exe, version); //0.73.0
139+
if(strcasecmp(exeName, "python") == 0 && getenv("XONSH_VERSION"))
140+
{
141+
ffStrbufSetS(version, getenv("XONSH_VERSION"));
142+
return true;
143+
}
139144

140145
#ifdef _WIN32
141146
if(strcasecmp(exeName, "powershell") == 0 || strcasecmp(exeName, "powershell_ise") == 0)

src/detection/terminalshell/terminalshell_linux.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static void getTerminalShell(FFTerminalShellResult* result, pid_t pid)
148148
}
149149

150150
//Known shells
151-
if(
151+
if (
152152
strcasecmp(name, "bash") == 0 ||
153153
strcasecmp(name, "zsh") == 0 ||
154154
strcasecmp(name, "ksh") == 0 ||
@@ -158,7 +158,8 @@ static void getTerminalShell(FFTerminalShellResult* result, pid_t pid)
158158
strcasecmp(name, "dash") == 0 ||
159159
strcasecmp(name, "pwsh") == 0 ||
160160
strcasecmp(name, "nu") == 0 ||
161-
strcasecmp(name, "git-shell") == 0
161+
strcasecmp(name, "git-shell") == 0 ||
162+
(strcasecmp(name, "python") == 0 && getenv("XONSH_VERSION"))
162163
) {
163164
if (result->shellProcessName.length == 0)
164165
{
@@ -369,6 +370,8 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
369370
ffStrbufInitS(&result.shellPrettyName, "PowerShell");
370371
else if(ffStrbufEqualS(&result.shellProcessName, "nu"))
371372
ffStrbufInitS(&result.shellPrettyName, "nushell");
373+
else if(ffStrbufIgnCaseEqualS(&result.shellProcessName, "python") && getenv("XONSH_VERSION"))
374+
ffStrbufInitS(&result.shellPrettyName, "xonsh");
372375
else
373376
{
374377
// https://github.com/LinusDierheimer/fastfetch/discussions/280#discussioncomment-3831734

0 commit comments

Comments
 (0)