mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Display: allow "compactType": null; improve json schema
This commit is contained in:
+27
-8
@@ -2031,15 +2031,34 @@
|
||||
"const": "display"
|
||||
},
|
||||
"compactType": {
|
||||
"enum": [
|
||||
"none",
|
||||
"original",
|
||||
"scaled",
|
||||
"original-with-refresh-rate",
|
||||
"scaled-with-refresh-rate"
|
||||
],
|
||||
"description": "Set if all displays should be printed in one line",
|
||||
"default": "none"
|
||||
"oneOf": [
|
||||
{
|
||||
"const": null,
|
||||
"description": "Disable compact mode"
|
||||
},
|
||||
{
|
||||
"const": "none",
|
||||
"description": "Disable compact mode (kept for compatibility)"
|
||||
},
|
||||
{
|
||||
"const": "original",
|
||||
"description": "Print original resolutions"
|
||||
},
|
||||
{
|
||||
"const": "scaled",
|
||||
"description": "Print scaled resolutions"
|
||||
},
|
||||
{
|
||||
"const": "original-with-refresh-rate",
|
||||
"description": "Print original resolutions with refresh rates"
|
||||
},
|
||||
{
|
||||
"const": "scaled-with-refresh-rate",
|
||||
"description": "Print scaled resolutions with refresh rates"
|
||||
}
|
||||
],
|
||||
"default": null
|
||||
},
|
||||
"preciseRefreshRate": {
|
||||
"description": "Set if decimal refresh rates should not be rounded into integers when printing",
|
||||
|
||||
@@ -267,6 +267,10 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
|
||||
if (unsafe_yyjson_equals_str(key, "compactType"))
|
||||
{
|
||||
if (yyjson_is_null(val))
|
||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||
else
|
||||
{
|
||||
int value;
|
||||
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
|
||||
@@ -281,6 +285,7 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
|
||||
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
|
||||
else
|
||||
options->compactType = (FFDisplayCompactType) value;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user