mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 00:03:58 +01:00
JsonConfig: write all flags when generating config file
This commit is contained in:
@@ -282,35 +282,41 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
|
||||
|
||||
void ffGenerateDisplayJsonConfig(FFDisplayOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
__attribute__((__cleanup__(ffDestroyDisplayOptions))) FFDisplayOptions defaultOptions;
|
||||
ffInitDisplayOptions(&defaultOptions);
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
|
||||
|
||||
if (options->compactType != defaultOptions.compactType)
|
||||
switch ((int) options->compactType)
|
||||
{
|
||||
switch ((int) options->compactType)
|
||||
{
|
||||
case FF_DISPLAY_COMPACT_TYPE_NONE:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "none");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "original");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "original-with-refresh-rate");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled-with-refresh-rate");
|
||||
break;
|
||||
}
|
||||
case FF_DISPLAY_COMPACT_TYPE_NONE:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "none");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "original");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_ORIGINAL_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "original-with-refresh-rate");
|
||||
break;
|
||||
case FF_DISPLAY_COMPACT_TYPE_SCALED_BIT | FF_DISPLAY_COMPACT_TYPE_REFRESH_RATE_BIT:
|
||||
yyjson_mut_obj_add_str(doc, module, "compactType", "scaled-with-refresh-rate");
|
||||
break;
|
||||
}
|
||||
|
||||
if (options->preciseRefreshRate != defaultOptions.preciseRefreshRate)
|
||||
yyjson_mut_obj_add_bool(doc, module, "preciseRefreshRate", options->preciseRefreshRate);
|
||||
yyjson_mut_obj_add_bool(doc, module, "preciseRefreshRate", options->preciseRefreshRate);
|
||||
|
||||
switch (options->order)
|
||||
{
|
||||
case FF_DISPLAY_ORDER_NONE:
|
||||
yyjson_mut_obj_add_null(doc, module, "order");
|
||||
break;
|
||||
case FF_DISPLAY_ORDER_ASC:
|
||||
yyjson_mut_obj_add_str(doc, module, "order", "asc");
|
||||
break;
|
||||
case FF_DISPLAY_ORDER_DESC:
|
||||
yyjson_mut_obj_add_str(doc, module, "order", "desc");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
|
||||
Reference in New Issue
Block a user