diff --git a/src/common.c b/src/common.c index 14607c0a2..5f3ecc5a6 100644 --- a/src/common.c +++ b/src/common.c @@ -25,6 +25,8 @@ void ffDefaultConfig(FFconfig* config) config->showErrors = false; config->recache = false; + config->shellShowPath = false; + config->batteryShowManufacturer = true; config->batteryShowModel = true; config->batteryShowTechnology = true; diff --git a/src/fastfetch.c b/src/fastfetch.c index a36426692..78b880925 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -31,6 +31,9 @@ "## Logo options:\n" \ "# --color-logo true\n" \ "\n" \ + "## Shell options:\n" \ + "# --shell-path false\n" \ + "\n" \ "## Battery options:\n" \ "# --battery-manufacturer true\n" \ "# --battery-model true\n" \ @@ -73,6 +76,9 @@ static void printHelp() " -l , --logo : sets the shown logo. Also changes the main color accordingly\n" " --color-logo : if set to false, the logo will be black / white\n" "\n" + "Shell options:\n" + " --shell-path : Show the full path of the shell\n" + "\n" "Battery options:\n" " --battery-manufacturer : Show the manufacturer of the battery, if possible\n" " --battery-model : Show the model of the battery, if possible\n" @@ -340,6 +346,13 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con else instance->config.recache = parseBoolean(value); } + else if(strcasecmp(key, "--shell-path") == 0) + { + if(value == NULL) + instance->config.shellShowPath = true; + else + instance->config.shellShowPath = parseBoolean(value); + } else if(strcasecmp(key, "--battery-manufacturer") == 0) { if(value == NULL) @@ -466,7 +479,7 @@ static void parseConfigFile(FFinstance* instance, FFdata* data) while(*valueStart == ' ') ++valueStart; - //If we want whitespace in values, we need to quote it. This is done to keep consistency whith shell. + //If we want whitespace in values, we need to quote it. This is done to keep consistency with shell. if(*valueStart == '"') { char* last = valueStart + strlen(valueStart) - 1; @@ -553,7 +566,7 @@ int main(int argc, const char** argv) parseConfigFile(&instance, &data); parseArguments(&instance, &data, argc, argv); - applyData(&instance, &data); + applyData(&instance, &data); //Here we do things that need to be done after parsing all options run(&instance, &data); diff --git a/src/fastfetch.h b/src/fastfetch.h index 4e73e9a83..a504611f8 100644 --- a/src/fastfetch.h +++ b/src/fastfetch.h @@ -41,6 +41,8 @@ typedef struct FFconfig bool showErrors; bool recache; + bool shellShowPath; + char batteryFormat[32]; bool batteryShowManufacturer; bool batteryShowModel; diff --git a/src/modules/shell.c b/src/modules/shell.c index 84f8ec385..875fa6b9c 100644 --- a/src/modules/shell.c +++ b/src/modules/shell.c @@ -12,12 +12,20 @@ void ffPrintShell(FFinstance* instance) return; } - char* shellName = strrchr(shellPath, '/'); + char* value; - if(shellName == NULL) - shellName = shellPath; - else if(shellName[0] == '/') - ++shellName; + if(!instance->config.shellShowPath) + { + char* shellName = strrchr(shellPath, '/'); + if(shellName != NULL) + value = ++shellName; + else + value = shellPath; + } + else + { + value = shellPath; + } - ffPrintAndSaveCachedValue(instance, "Shell", shellName); + ffPrintAndSaveCachedValue(instance, "Shell", value); } \ No newline at end of file