Chore: run clang-format

```bash
find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i
```
This commit is contained in:
李通洲
2026-03-29 09:28:49 +08:00
parent cdd4cee968
commit e0eba8ce21
690 changed files with 28093 additions and 30062 deletions
+1 -2
View File
@@ -3,8 +3,7 @@
#include "fastfetch.h"
#include "modules/theme/option.h"
typedef struct FFThemeResult
{
typedef struct FFThemeResult {
FFstrbuf theme1;
FFstrbuf theme2;
} FFThemeResult;
+2 -4
View File
@@ -2,15 +2,13 @@
#include "detection/os/os.h"
const char* ffDetectTheme(FFThemeResult* result)
{
const char* ffDetectTheme(FFThemeResult* result) {
const FFOSResult* os = ffDetectOS();
char* str_end;
const char* version = os->version.chars;
unsigned long osNum = strtoul(version, &str_end, 10);
if (str_end != version)
{
if (str_end != version) {
if (osNum > 15) { // Tahoe
ffStrbufSetStatic(&result->theme1, "Liquid Glass");
} else if (osNum < 10) {
+19 -18
View File
@@ -3,57 +3,58 @@
#include "detection/gtk_qt/gtk_qt.h"
#include "detection/displayserver/displayserver.h"
const char* ffDetectTheme(FFThemeResult* result)
{
const char* ffDetectTheme(FFThemeResult* result) {
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
if(ffStrbufIgnCaseEqualS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY))
if (ffStrbufIgnCaseEqualS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY)) {
return "Theme isn't supported in TTY";
}
const FFQtResult* plasma = ffDetectQt();
const FFstrbuf* gtk2 = &ffDetectGTK2()->theme;
const FFstrbuf* gtk3 = &ffDetectGTK3()->theme;
const FFstrbuf* gtk4 = &ffDetectGTK4()->theme;
if(plasma->widgetStyle.length == 0 && plasma->colorScheme.length == 0 && gtk2->length == 0 && gtk3->length == 0 && gtk4->length == 0)
if (plasma->widgetStyle.length == 0 && plasma->colorScheme.length == 0 && gtk2->length == 0 && gtk3->length == 0 && gtk4->length == 0) {
return "No themes found";
}
ffParseGTK(&result->theme2, gtk2, gtk3, gtk4);
FF_STRBUF_AUTO_DESTROY plasmaColorPretty = ffStrbufCreate();
if(ffStrbufStartsWithIgnCase(&plasma->colorScheme, &plasma->widgetStyle))
if (ffStrbufStartsWithIgnCase(&plasma->colorScheme, &plasma->widgetStyle)) {
ffStrbufAppendNS(&plasmaColorPretty, plasma->colorScheme.length - plasma->widgetStyle.length, &plasma->colorScheme.chars[plasma->widgetStyle.length]);
else
} else {
ffStrbufAppend(&plasmaColorPretty, &plasma->colorScheme);
}
ffStrbufTrim(&plasmaColorPretty, ' ');
if(plasma->widgetStyle.length > 0)
{
if (plasma->widgetStyle.length > 0) {
ffStrbufAppend(&result->theme1, &plasma->widgetStyle);
if(plasma->colorScheme.length > 0)
{
if (plasma->colorScheme.length > 0) {
ffStrbufAppendS(&result->theme1, " (");
if(plasmaColorPretty.length > 0)
if (plasmaColorPretty.length > 0) {
ffStrbufAppend(&result->theme1, &plasmaColorPretty);
else
} else {
ffStrbufAppend(&result->theme1, &plasma->colorScheme);
}
ffStrbufAppendC(&result->theme1, ')');
}
}
else if(plasma->colorScheme.length > 0)
{
if(plasmaColorPretty.length > 0)
} else if (plasma->colorScheme.length > 0) {
if (plasmaColorPretty.length > 0) {
ffStrbufAppend(&result->theme1, &plasmaColorPretty);
else
} else {
ffStrbufAppend(&result->theme1, &plasma->colorScheme);
}
}
if(plasma->widgetStyle.length > 0 || plasma->colorScheme.length > 0)
if (plasma->widgetStyle.length > 0 || plasma->colorScheme.length > 0) {
ffStrbufAppendS(&result->theme1, " [Qt]");
}
return NULL;
}
+1 -2
View File
@@ -1,6 +1,5 @@
#include "theme.h"
const char* ffDetectTheme(FF_MAYBE_UNUSED FFThemeResult* result)
{
const char* ffDetectTheme(FF_MAYBE_UNUSED FFThemeResult* result) {
return "Not supported on this platform";
}
+11 -13
View File
@@ -2,28 +2,26 @@
#include "detection/os/os.h"
const char* ffDetectTheme(FFThemeResult* result)
{
const char* ffDetectTheme(FFThemeResult* result) {
const FFOSResult* os = ffDetectOS();
uint32_t ver = (uint32_t) ffStrbufToUInt(&os->version, 0);
if (ver > 1000)
{
if (ver > 1000) {
// Windows Server
if (ver >= 2016)
if (ver >= 2016) {
ffStrbufSetStatic(&result->theme1, "Fluent");
else if (ver >= 2012)
} else if (ver >= 2012) {
ffStrbufSetStatic(&result->theme1, "Metro");
else
} else {
ffStrbufSetStatic(&result->theme1, "Aero");
}
else
{
if (ver >= 10)
}
} else {
if (ver >= 10) {
ffStrbufSetStatic(&result->theme1, "Fluent");
else if (ver >= 8)
} else if (ver >= 8) {
ffStrbufSetStatic(&result->theme1, "Metro");
else
} else {
ffStrbufSetStatic(&result->theme1, "Aero");
}
}
return NULL;
}