mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
JsonConfig: support "logo": null
and "logo": "/path/to/logo"
This commit is contained in:
parent
9021c6ee82
commit
f0844d7636
@ -27,6 +27,16 @@
|
||||
"format": "uri"
|
||||
},
|
||||
"logo": {
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Disable logo",
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"title": "Set the source file of the logo",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"title": "Fastfetch logo configurations",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -183,6 +193,8 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"general": {
|
||||
"title": "Fastfetch general configurations",
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"source": "debian_small"
|
||||
},
|
||||
"logo": "debian_small",
|
||||
"display": {
|
||||
"binaryPrefix": "si"
|
||||
},
|
||||
|
@ -2,9 +2,7 @@
|
||||
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "none"
|
||||
},
|
||||
"logo": null,
|
||||
"display": {
|
||||
"color": "reset_magenta"
|
||||
},
|
||||
|
@ -410,6 +410,12 @@ void ffLogoPrint(void)
|
||||
|
||||
const FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
if (options->type == FF_LOGO_TYPE_NONE)
|
||||
{
|
||||
logoPrintNone();
|
||||
return;
|
||||
}
|
||||
|
||||
//If the source is not set, we can directly print the detected logo.
|
||||
if(options->source.length == 0)
|
||||
{
|
||||
|
@ -201,6 +201,22 @@ const char* ffParseLogoJsonConfig(void)
|
||||
|
||||
yyjson_val* object = yyjson_obj_get(root, "logo");
|
||||
if (!object) return NULL;
|
||||
if (yyjson_is_null(object))
|
||||
{
|
||||
options->type = FF_LOGO_TYPE_NONE;
|
||||
options->paddingTop = 0;
|
||||
options->paddingRight = 0;
|
||||
options->paddingLeft = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (yyjson_is_str(object))
|
||||
{
|
||||
const char* value = yyjson_get_str(object);
|
||||
ffStrbufSetS(&options->source, value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!yyjson_is_obj(object)) return "Property 'logo' must be an object";
|
||||
|
||||
yyjson_val *key_, *val;
|
||||
|
Loading…
x
Reference in New Issue
Block a user