diff --git a/src/common/init.c b/src/common/init.c index 3f26cc3cc..0c4674755 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -363,10 +363,6 @@ static void exitSignalHandler(int signal) void ffStart(FFinstance* instance) { - ffPrepareCPUUsage(); - ffPreparePublicIp(instance); - ffPrepareWeather(instance); - if(instance->config.multithreading) startDetectionThreads(instance); diff --git a/src/fastfetch.c b/src/fastfetch.c index 8acb7419c..a42c0d802 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -1485,6 +1485,19 @@ int main(int argc, const char** argv) if(data.structure.length == 0) ffStrbufAppendS(&data.structure, FASTFETCH_DATATEXT_STRUCTURE); + #define FF_CONTAINS_MODULE_NAME(moduleName)\ + ffStrbufContainIgnCaseS(&data.structure, ":" #moduleName ":") ||\ + ffStrbufStartsWithIgnCaseS(&data.structure, #moduleName ":") ||\ + ffStrbufEndsWithIgnCaseS(&data.structure, ":" #moduleName) + + if(FF_CONTAINS_MODULE_NAME(CPUUsage)) + ffPrepareCPUUsage(); + if(FF_CONTAINS_MODULE_NAME(PublicIp)) + ffPreparePublicIp(&instance); + if(FF_CONTAINS_MODULE_NAME(Weather)) + ffPrepareWeather(&instance); + #undef FF_CONTAINS_MODULE_NAME + ffStart(&instance); //Parse the structure and call the modules diff --git a/src/flashfetch.c b/src/flashfetch.c index 159847956..e20b2aa1b 100644 --- a/src/flashfetch.c +++ b/src/flashfetch.c @@ -10,6 +10,10 @@ int main(int argc, char** argv) //Modify instance.config here + // ffPrepareCPUUsage(); + // ffPreparePublicIp(&instance); + // ffPrepareWeather(&instance); + //Does things like starting detection threads, disabling line wrap, etc ffStart(&instance);