mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Init: don't pay for unused module
Networking can be very slow
This commit is contained in:
@@ -363,10 +363,6 @@ static void exitSignalHandler(int signal)
|
||||
|
||||
void ffStart(FFinstance* instance)
|
||||
{
|
||||
ffPrepareCPUUsage();
|
||||
ffPreparePublicIp(instance);
|
||||
ffPrepareWeather(instance);
|
||||
|
||||
if(instance->config.multithreading)
|
||||
startDetectionThreads(instance);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user