mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-03 11:44:18 +01:00
JsonConfig: support "logo": null and "logo": "/path/to/logo"
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user