Files
fastfetch/src/modules/icons.c
T

51 lines
1.6 KiB
C
Raw Normal View History

2021-02-18 22:25:36 +01:00
#include "fastfetch.h"
2021-04-15 18:59:26 +02:00
#define FF_ICONS_MODULE_NAME "Icons"
#define FF_ICONS_NUM_FORMAT_ARGS 5
2021-02-27 18:30:05 +01:00
void ffPrintIcons(FFinstance* instance)
2021-02-18 22:25:36 +01:00
{
2021-04-28 19:53:30 +02:00
const FFstrbuf* plasma = &ffDetectPlasma(instance)->icons;
const FFstrbuf* gtk2 = &ffDetectGTK2(instance)->icons;
const FFstrbuf* gtk3 = &ffDetectGTK3(instance)->icons;
const FFstrbuf* gtk4 = &ffDetectGTK4(instance)->icons;
2021-03-27 18:14:19 +01:00
if(plasma->length == 0 && gtk2->length == 0 && gtk3->length == 0 && gtk4->length == 0)
2021-04-05 19:25:34 +02:00
{
2021-04-15 18:59:26 +02:00
ffPrintError(instance, FF_ICONS_MODULE_NAME, 0, &instance->config.iconsKey, &instance->config.iconsFormat, FF_ICONS_NUM_FORMAT_ARGS, "No icons could be found");
2021-04-05 19:25:34 +02:00
return;
}
2021-03-19 20:57:07 +01:00
FF_STRBUF_CREATE(gtkPretty);
ffGetGtkPretty(&gtkPretty, gtk2, gtk3, gtk4);
2021-03-19 20:57:07 +01:00
2021-03-23 19:48:52 +01:00
if(instance->config.iconsFormat.length == 0)
2021-03-19 20:57:07 +01:00
{
2021-04-15 18:59:26 +02:00
ffPrintLogoAndKey(instance, FF_ICONS_MODULE_NAME, 0, &instance->config.iconsKey);
2021-03-27 18:14:19 +01:00
if(plasma->length > 0)
2021-04-07 12:55:11 +02:00
{
ffStrbufWriteTo(plasma, stdout);
2021-04-07 12:55:11 +02:00
fputs(" [Plasma]", stdout);
if(gtkPretty.length > 0)
fputs(", ", stdout);
}
2021-03-19 20:57:07 +01:00
2021-03-22 20:02:32 +01:00
ffStrbufPutTo(&gtkPretty, stdout);
2021-03-19 20:57:07 +01:00
}
2021-02-19 16:23:41 +01:00
else
2021-03-19 20:57:07 +01:00
{
2021-04-15 18:59:26 +02:00
ffPrintFormatString(instance, FF_ICONS_MODULE_NAME, 0, &instance->config.iconsKey, &instance->config.iconsFormat, NULL, FF_ICONS_NUM_FORMAT_ARGS, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, plasma},
{FF_FORMAT_ARG_TYPE_STRBUF, gtk2},
{FF_FORMAT_ARG_TYPE_STRBUF, gtk3},
{FF_FORMAT_ARG_TYPE_STRBUF, gtk4},
2021-04-15 18:59:26 +02:00
{FF_FORMAT_ARG_TYPE_STRBUF, &gtkPretty}
});
2021-03-19 20:57:07 +01:00
}
2021-02-18 22:25:36 +01:00
2021-03-19 20:57:07 +01:00
ffStrbufDestroy(&gtkPretty);
2021-03-27 18:14:19 +01:00
}