mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 17:41:41 +01:00
TerminalShell: add --shell-version and --terminal-version options to disable shell / terminal version detection
in case that users don't like it
This commit is contained in:
@@ -315,6 +315,9 @@ static void defaultConfig(FFinstance* instance)
|
||||
instance->config.gpuTemp = false;
|
||||
instance->config.batteryTemp = false;
|
||||
|
||||
instance->config.shellVersion = true;
|
||||
instance->config.terminalVersion = true;
|
||||
|
||||
instance->config.titleFQDN = false;
|
||||
|
||||
ffStrbufInitA(&instance->config.diskFolders, 0);
|
||||
|
||||
@@ -212,6 +212,18 @@
|
||||
# Default is auto.
|
||||
#--gl auto
|
||||
|
||||
# Shell option
|
||||
# Sets if shell version should be detected and printed
|
||||
# Must be either true or false
|
||||
# Default is true.
|
||||
#--shell-version true
|
||||
|
||||
# Terminal option
|
||||
# Sets if terminal version should be detected and printed
|
||||
# Must be either true or false
|
||||
# Default is true.
|
||||
#--terminal-version true
|
||||
|
||||
# Disk option
|
||||
# Sets if removable volume should be printed
|
||||
# Must be either true or false
|
||||
|
||||
@@ -103,6 +103,8 @@ Module specific options:
|
||||
--title-fqdn <?value>: Set if the title should use fully qualified domain name. Default is false
|
||||
--separator-string <str>: Set the string printed by the separator module
|
||||
--os-file <path>: Set the path to the file containing OS information
|
||||
--shell-version <?value>: Set if shell version should be detected and printed
|
||||
--terminal-version <?value>: Set if terminal version should be detected and printed
|
||||
--disk-folders <folders>: A colon (semicolon on Windows) separated list of folder paths for the disk output. Default is "/:/home" ("C:\\;D:\\ ..." on Windows)
|
||||
--disk-show-removable <?value>: Set if removable volume should be printed. Default is true
|
||||
--disk-show-hidden <?value>: Set if hidden volumes should be printed. Default is false
|
||||
|
||||
@@ -352,12 +352,17 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
|
||||
|
||||
getTerminalFromEnv(&result);
|
||||
getUserShellFromEnv(instance, &result);
|
||||
getShellVersion(&result.shellExe, result.shellExeName, &result.shellVersion);
|
||||
|
||||
if(strcasecmp(result.shellExeName, result.userShellExeName) != 0)
|
||||
getShellVersion(&result.userShellExe, result.userShellExeName, &result.userShellVersion);
|
||||
else
|
||||
ffStrbufSet(&result.userShellVersion, &result.shellVersion);
|
||||
ffStrbufClear(&result.shellVersion);
|
||||
if(instance->config.shellVersion)
|
||||
{
|
||||
getShellVersion(&result.shellExe, result.shellExeName, &result.shellVersion);
|
||||
|
||||
if(strcasecmp(result.shellExeName, result.userShellExeName) != 0)
|
||||
getShellVersion(&result.userShellExe, result.userShellExeName, &result.userShellVersion);
|
||||
else
|
||||
ffStrbufSet(&result.userShellVersion, &result.shellVersion);
|
||||
}
|
||||
|
||||
if(ffStrbufEqualS(&result.shellProcessName, "pwsh"))
|
||||
ffStrbufInitS(&result.shellPrettyName, "PowerShell");
|
||||
@@ -383,7 +388,9 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
|
||||
ffStrbufInitCopy(&result.terminalPrettyName, &result.terminalProcessName);
|
||||
|
||||
ffStrbufInit(&result.terminalVersion);
|
||||
fftsGetTerminalVersion(&result.terminalProcessName, &result.terminalExe, &result.terminalVersion);
|
||||
|
||||
if(instance->config.terminalVersion)
|
||||
fftsGetTerminalVersion(&result.terminalProcessName, &result.terminalExe, &result.terminalVersion);
|
||||
|
||||
ffThreadMutexUnlock(&mutex);
|
||||
return &result;
|
||||
|
||||
@@ -132,7 +132,8 @@ static uint32_t getShellInfo(FFTerminalShellResult* result, uint32_t pid)
|
||||
}
|
||||
|
||||
ffStrbufClear(&result->shellVersion);
|
||||
fftsGetShellVersion(&result->shellExe, result->shellPrettyName.chars, &result->shellVersion);
|
||||
if(instance->config.shellVersion)
|
||||
fftsGetShellVersion(&result->shellExe, result->shellPrettyName.chars, &result->shellVersion);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(&result->shellPrettyName, "pwsh"))
|
||||
ffStrbufSetS(&result->shellPrettyName, "PowerShell");
|
||||
@@ -305,7 +306,8 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
|
||||
getTerminalFromEnv(&result);
|
||||
|
||||
ffStrbufInit(&result.terminalVersion);
|
||||
fftsGetTerminalVersion(&result.terminalProcessName, &result.terminalExe, &result.terminalVersion);
|
||||
if(instance->config.terminalVersion)
|
||||
fftsGetTerminalVersion(&result.terminalProcessName, &result.terminalExe, &result.terminalVersion);
|
||||
|
||||
exit:
|
||||
ffThreadMutexUnlock(&mutex);
|
||||
|
||||
@@ -1248,6 +1248,10 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
instance->config.batteryTemp = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--title-fqdn") == 0)
|
||||
instance->config.titleFQDN = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--shell-version") == 0)
|
||||
instance->config.shellVersion = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--terminal-version") == 0)
|
||||
instance->config.terminalVersion = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--disk-folders") == 0)
|
||||
optionParseString(key, value, &instance->config.diskFolders);
|
||||
else if(strcasecmp(key, "--disk-show-removable") == 0)
|
||||
|
||||
@@ -177,6 +177,9 @@ typedef struct FFconfig
|
||||
|
||||
bool titleFQDN;
|
||||
|
||||
bool shellVersion;
|
||||
bool terminalVersion;
|
||||
|
||||
FFstrbuf diskFolders;
|
||||
bool diskShowRemovable;
|
||||
bool diskShowHidden;
|
||||
|
||||
Reference in New Issue
Block a user