Display: always show display name

This commit is contained in:
李通洲
2023-06-20 17:28:10 +08:00
parent baebbb61eb
commit 1716489396
2 changed files with 10 additions and 22 deletions
+1 -6
View File
@@ -2,7 +2,6 @@
#include "common/printing.h"
#include "common/jsonconfig.h"
#include "detection/brightness/brightness.h"
#include "detection/displayserver/displayserver.h"
#include "modules/brightness/brightness.h"
#include "util/stringUtils.h"
@@ -12,8 +11,6 @@ void ffPrintBrightness(FFinstance* instance, FFBrightnessOptions* options)
{
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFBrightnessResult));
const FFDisplayServerResult* ds = ffConnectDisplayServer(instance);
const char* error = ffDetectBrightness(&result);
if(error)
@@ -34,9 +31,7 @@ void ffPrintBrightness(FFinstance* instance, FFBrightnessOptions* options)
{
if(options->moduleArgs.key.length == 0)
{
ffStrbufAppendS(&key, FF_BRIGHTNESS_MODULE_NAME);
if (ds->displays.length > 1)
ffStrbufAppendF(&key, " (%s)", item->name.chars);
ffStrbufAppendF(&key, "%s (%s)", FF_BRIGHTNESS_MODULE_NAME, item->name.chars);
}
else
{
+9 -16
View File
@@ -53,27 +53,20 @@ void ffPrintDisplay(FFinstance* instance, FFDisplayOptions* options)
if(options->moduleArgs.outputFormat.length == 0)
{
if(moduleIndex > 0)
ffStrbufClear(&key);
if(options->moduleArgs.key.length == 0)
{
ffStrbufClear(&key);
if(options->moduleArgs.key.length == 0)
{
ffStrbufAppendF(&key, "%s (%s)", FF_DISPLAY_MODULE_NAME, result->name.length ? result->name.chars : displayType);
}
else
{
ffParseFormatString(&key, &options->moduleArgs.key, 1, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &i},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
{FF_FORMAT_ARG_TYPE_STRING, displayType},
});
}
ffPrintLogoAndKey(instance, key.chars, 0, NULL, &options->moduleArgs.keyColor);
ffStrbufAppendF(&key, "%s (%s)", FF_DISPLAY_MODULE_NAME, result->name.length ? result->name.chars : displayType);
}
else
{
ffPrintLogoAndKey(instance, FF_DISPLAY_MODULE_NAME, moduleIndex, &options->moduleArgs.key, &options->moduleArgs.keyColor);
ffParseFormatString(&key, &options->moduleArgs.key, 1, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_UINT, &i},
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
{FF_FORMAT_ARG_TYPE_STRING, displayType},
});
}
ffPrintLogoAndKey(instance, key.chars, 0, NULL, &options->moduleArgs.keyColor);
printf("%ix%i", result->width, result->height);