mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-05 04:34:19 +01:00
Modules: return bool to indicate whether the detection is succeeded
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
void ffPrintMonitor(FFMonitorOptions* options)
|
||||
bool ffPrintMonitor(FFMonitorOptions* options)
|
||||
{
|
||||
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
||||
|
||||
if(!result->displays.length)
|
||||
{
|
||||
ffPrintError(FF_MONITOR_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No display detected");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
@@ -84,6 +84,8 @@ void ffPrintMonitor(FFMonitorOptions* options)
|
||||
ffStrbufDestroy(&display->name);
|
||||
++index;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffParseMonitorJsonObject(FFMonitorOptions* options, yyjson_val* module)
|
||||
@@ -104,9 +106,10 @@ void ffGenerateMonitorJsonConfig(FFMonitorOptions* options, yyjson_mut_doc* doc,
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffGenerateMonitorJsonResult(FF_MAYBE_UNUSED FFMonitorOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
bool ffGenerateMonitorJsonResult(FF_MAYBE_UNUSED FFMonitorOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
yyjson_mut_obj_add_str(doc, module, "error", "Monitor module is an alias of Display module");
|
||||
return false;
|
||||
}
|
||||
|
||||
void ffInitMonitorOptions(FFMonitorOptions* options)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#define FF_MONITOR_MODULE_NAME "Monitor"
|
||||
|
||||
void ffPrintMonitor(FFMonitorOptions* options);
|
||||
bool ffPrintMonitor(FFMonitorOptions* options);
|
||||
void ffInitMonitorOptions(FFMonitorOptions* options);
|
||||
void ffDestroyMonitorOptions(FFMonitorOptions* options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user