From 1716489396b7cef918dc3a57f513ef2c4720fcfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 20 Jun 2023 17:28:10 +0800 Subject: [PATCH] Display: always show display name --- src/modules/brightness/brightness.c | 7 +------ src/modules/display/display.c | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/modules/brightness/brightness.c b/src/modules/brightness/brightness.c index 8f53caf77..32c0ca408 100644 --- a/src/modules/brightness/brightness.c +++ b/src/modules/brightness/brightness.c @@ -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 { diff --git a/src/modules/display/display.c b/src/modules/display/display.c index ddbe7536c..d33bfefea 100644 --- a/src/modules/display/display.c +++ b/src/modules/display/display.c @@ -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);