Wallpaper (Windows): add new module

This commit is contained in:
李通洲
2023-06-06 15:48:24 +08:00
parent 7934c16bca
commit 77b93a904f
10 changed files with 82 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
#include "fastfetch.h"
#include "common/printing.h"
#include "detection/wallpaper/wallpaper.h"
#define FF_WALLPAPER_MODULE_NAME "Wallpaper"
#define FF_WALLPAPER_NUM_FORMAT_ARGS 1
void ffPrintWallpaper(FFinstance* instance)
{
FF_STRBUF_AUTO_DESTROY wallpaper;
ffStrbufInit(&wallpaper);
const char* error = ffDetectWallpaper(instance, &wallpaper);
if(error)
{
ffPrintError(instance, FF_WALLPAPER_MODULE_NAME, 0, &instance->config.wallpaper, "%s", error);
return;
}
if(instance->config.wallpaper.outputFormat.length == 0)
{
ffPrintLogoAndKey(instance, FF_WALLPAPER_MODULE_NAME, 0, &instance->config.wallpaper.key);
ffStrbufPutTo(&wallpaper, stdout);
}
else
{
ffPrintFormat(instance, FF_WALLPAPER_MODULE_NAME, 0, &instance->config.wallpaper, FF_WALLPAPER_NUM_FORMAT_ARGS, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &wallpaper}
});
}
}