mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-07 21:50:08 +01:00
Battery (Windows): add flag --battery-use-setup-api
This commit is contained in:
@@ -122,6 +122,14 @@ bool ffParseBatteryCommandOptions(FFBatteryOptions* options, const char* key, co
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (ffStrEqualsIgnCase(subKey, "use-setup-api"))
|
||||
{
|
||||
options->useSetupApi = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,6 +154,14 @@ void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (ffStrEqualsIgnCase(key, "useSetupApi"))
|
||||
{
|
||||
options->useSetupApi = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "temp"))
|
||||
{
|
||||
options->temp = yyjson_get_bool(val);
|
||||
@@ -168,6 +184,11 @@ void ffGenerateBatteryJsonConfig(FFBatteryOptions* options, yyjson_mut_doc* doc,
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "dir", &options->dir);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
if (defaultOptions.useSetupApi != options->useSetupApi)
|
||||
yyjson_mut_obj_add_bool(doc, module, "useSetupApi", options->useSetupApi);
|
||||
#endif
|
||||
|
||||
if (options->temp != defaultOptions.temp)
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", options->temp);
|
||||
}
|
||||
@@ -233,6 +254,8 @@ void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
|
||||
#ifdef __linux__
|
||||
ffStrbufInit(&options->dir);
|
||||
#elif defined(_WIN32)
|
||||
options->useSetupApi = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -13,5 +13,7 @@ typedef struct FFBatteryOptions
|
||||
|
||||
#ifdef __linux__
|
||||
FFstrbuf dir;
|
||||
#elif defined(_WIN32)
|
||||
bool useSetupApi;
|
||||
#endif
|
||||
} FFBatteryOptions;
|
||||
|
||||
Reference in New Issue
Block a user