mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
plasma color theme detection
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@
|
||||
void ffPrintFont(FFinstance* instance)
|
||||
{
|
||||
FFstrbuf* plasma;
|
||||
ffCalculatePlasma(instance, NULL, NULL, &plasma);
|
||||
ffCalculatePlasma(instance, NULL, NULL, NULL, &plasma);
|
||||
|
||||
FFstrbuf* gtk2;
|
||||
ffCalculateGTK2(instance, NULL, NULL, >k2);
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
void ffPrintIcons(FFinstance* instance)
|
||||
{
|
||||
FFstrbuf* plasma;
|
||||
ffCalculatePlasma(instance, NULL, &plasma, NULL);
|
||||
ffCalculatePlasma(instance, NULL, NULL, &plasma, NULL);
|
||||
|
||||
FFstrbuf* gtk2;
|
||||
ffCalculateGTK2(instance, NULL, >k2, NULL);
|
||||
|
||||
+44
-7
@@ -2,8 +2,9 @@
|
||||
|
||||
void ffPrintTheme(FFinstance* instance)
|
||||
{
|
||||
FFstrbuf* plasma;
|
||||
ffCalculatePlasma(instance, &plasma, NULL, NULL);
|
||||
FFstrbuf* plasmaTheme;
|
||||
FFstrbuf* plasmaColor;
|
||||
ffCalculatePlasma(instance, &plasmaTheme, &plasmaColor, NULL, NULL);
|
||||
|
||||
FFstrbuf* gtk2;
|
||||
ffCalculateGTK2(instance, >k2, NULL, NULL);
|
||||
@@ -14,12 +15,20 @@ void ffPrintTheme(FFinstance* instance)
|
||||
FFstrbuf* gtk4;
|
||||
ffCalculateGTK4(instance, >k4, NULL, NULL);
|
||||
|
||||
if(plasma->length == 0 && gtk2->length == 0 && gtk3->length == 0 && gtk4->length == 0)
|
||||
if(plasmaTheme->length == 0 && plasmaColor->length == 0 && gtk2->length == 0 && gtk3->length == 0 && gtk4->length == 0)
|
||||
{
|
||||
ffPrintError(instance, &instance->config.themeKey, "Theme", "No themes found");
|
||||
return;
|
||||
}
|
||||
|
||||
FF_STRBUF_CREATE(plasmaColorPretty);
|
||||
if(ffStrbufStartsWithIgnCase(plasmaColor, plasmaTheme))
|
||||
ffStrbufAppendNS(&plasmaColorPretty, plasmaColor->length - plasmaTheme->length, &plasmaColor->chars[plasmaTheme->length]);
|
||||
else
|
||||
ffStrbufAppend(&plasmaColorPretty, plasmaColor);
|
||||
|
||||
ffStrbufTrim(&plasmaColorPretty, ' ');
|
||||
|
||||
FF_STRBUF_CREATE(gtkPretty);
|
||||
ffGetGtkPretty(>kPretty, gtk2, gtk3, gtk4);
|
||||
|
||||
@@ -27,9 +36,32 @@ void ffPrintTheme(FFinstance* instance)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, &instance->config.themeKey, "Theme");
|
||||
|
||||
if(plasma->length > 0)
|
||||
if(plasmaTheme->length > 0)
|
||||
{
|
||||
ffStrbufWriteTo(plasmaTheme, stdout);
|
||||
|
||||
if(plasmaColor->length > 0)
|
||||
{
|
||||
fputs(" (", stdout);
|
||||
|
||||
if(plasmaColorPretty.length > 0)
|
||||
ffStrbufWriteTo(&plasmaColorPretty, stdout);
|
||||
else
|
||||
ffStrbufWriteTo(plasmaColor, stdout);
|
||||
|
||||
putchar(')');
|
||||
}
|
||||
}
|
||||
else if(plasmaColor->length > 0)
|
||||
{
|
||||
if(plasmaColorPretty.length > 0)
|
||||
ffStrbufWriteTo(&plasmaColorPretty, stdout);
|
||||
else
|
||||
ffStrbufWriteTo(plasmaColor, stdout);
|
||||
}
|
||||
|
||||
if(plasmaTheme->length > 0 || plasmaColor->length > 0)
|
||||
{
|
||||
ffStrbufWriteTo(plasma, stdout);
|
||||
fputs(" [Plasma]", stdout);
|
||||
|
||||
if(gtkPretty.length > 0)
|
||||
@@ -40,12 +72,17 @@ void ffPrintTheme(FFinstance* instance)
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormatString(instance, &instance->config.themeKey, "Theme", &instance->config.themeFormat, 5,
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, plasma},
|
||||
ffPrintFormatString(instance, &instance->config.themeKey, "Theme", &instance->config.themeFormat, 7,
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, plasmaTheme},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, plasmaColor},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, &plasmaColorPretty},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, gtk2},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, gtk3},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, gtk4},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, >kPretty}
|
||||
);
|
||||
}
|
||||
|
||||
ffStrbufDestroy(&plasmaColorPretty);
|
||||
ffStrbufDestroy(>kPretty);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user