mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Wallpaper (Linux): support KDE
This commit is contained in:
@@ -5,6 +5,9 @@ This release introduces a new configuration file format: JSON config
|
||||
Changes:
|
||||
* Drop the dependency of cJSON. We now use [yyjson](https://ibireme.github.io/yyjson/doc/doxygen/html/index.html) to parse JSON documents.
|
||||
|
||||
Features:
|
||||
* Support KDE wallpaper detection (Wallpaper, Linux)
|
||||
|
||||
# 1.11.3
|
||||
|
||||
Bugfixes:
|
||||
|
||||
@@ -21,6 +21,7 @@ typedef struct FFQtResult
|
||||
FFstrbuf colorScheme;
|
||||
FFstrbuf icons;
|
||||
FFstrbuf font;
|
||||
FFstrbuf wallpaper;
|
||||
} FFQtResult;
|
||||
|
||||
const FFGTKResult* ffDetectGTK2(const FFinstance* instance);
|
||||
|
||||
@@ -13,7 +13,8 @@ static inline bool allValuesSet(const FFQtResult* result)
|
||||
result->widgetStyle.length > 0 &&
|
||||
result->colorScheme.length > 0 &&
|
||||
result->icons.length > 0 &&
|
||||
result->font.length > 0;
|
||||
result->font.length > 0 &&
|
||||
result->wallpaper.length > 0;
|
||||
}
|
||||
|
||||
typedef enum PlasmaCategory
|
||||
@@ -95,6 +96,11 @@ static void detectPlasma(const FFinstance* instance, FFQtResult* result)
|
||||
if(detectPlasmaFromFile(baseDir.chars, result))
|
||||
foundAFile = true;
|
||||
|
||||
ffStrbufSet(&baseDir, configDir);
|
||||
ffStrbufAppendS(&baseDir, "plasma-org.kde.plasma.desktop-appletsrc");
|
||||
|
||||
ffParsePropFile(baseDir.chars, "Image=", &result->wallpaper);
|
||||
|
||||
if(allValuesSet(result))
|
||||
return;
|
||||
}
|
||||
@@ -144,6 +150,7 @@ const FFQtResult* ffDetectQt(const FFinstance* instance)
|
||||
ffStrbufInit(&result.colorScheme);
|
||||
ffStrbufInit(&result.icons);
|
||||
ffStrbufInit(&result.font);
|
||||
ffStrbufInit(&result.wallpaper);
|
||||
|
||||
const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance);
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ next:
|
||||
if(n->ut_type != USER_PROCESS)
|
||||
continue;
|
||||
|
||||
for(uint32_t i = 0; i < users->length; ++i)
|
||||
FF_LIST_FOR_EACH(FFstrbuf, user, *users)
|
||||
{
|
||||
if(ffStrbufCompS((FFstrbuf*)ffListGet(users, i), n->ut_user) == 0)
|
||||
if(ffStrbufCompS(user, n->ut_user) == 0)
|
||||
goto next;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,23 @@
|
||||
|
||||
const char* ffDetectWallpaper(const FFinstance* instance, FFstrbuf* result)
|
||||
{
|
||||
const FFstrbuf* wallpaper = NULL;
|
||||
const FFGTKResult* gtk = ffDetectGTK4(instance);
|
||||
if (!gtk->wallpaper.length)
|
||||
if (gtk->wallpaper.length)
|
||||
wallpaper = >k->wallpaper;
|
||||
else
|
||||
{
|
||||
const FFQtResult* qt = ffDetectQt(instance);
|
||||
if (qt->wallpaper.length)
|
||||
wallpaper = &qt->wallpaper;
|
||||
}
|
||||
|
||||
if (!wallpaper)
|
||||
return "Failed to detect the current wallpaper path";
|
||||
|
||||
if (ffStrbufStartsWithS(>k->wallpaper, "file:///"))
|
||||
ffStrbufAppendS(result, gtk->wallpaper.chars + strlen("file://"));
|
||||
if (ffStrbufStartsWithS(wallpaper, "file:///"))
|
||||
ffStrbufAppendS(result, wallpaper->chars + strlen("file://"));
|
||||
else
|
||||
ffStrbufAppend(result, >k->wallpaper);
|
||||
|
||||
ffStrbufAppend(result, wallpaper);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user