mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Display: remove --detect-name
This commit is contained in:
@@ -6,6 +6,7 @@ Changes:
|
||||
* Drop the dependency of cJSON. We now use [yyjson](https://ibireme.github.io/yyjson/doc/doxygen/html/index.html) to parse JSON documents.
|
||||
* Remove `--shell-version` and `--terminal-version`. They are always enabled
|
||||
* Remove `--*-error-format`
|
||||
* Remove `--display-detect-name`. Display name is always detected, and will be printed if multiple displays are detected
|
||||
|
||||
Features:
|
||||
* FreeBSD support is improved greatly, and actually tested in a phycial machine
|
||||
|
||||
@@ -747,12 +747,6 @@
|
||||
"description": "Set if all displays should be printed in one line",
|
||||
"default": "none"
|
||||
},
|
||||
"detectName": {
|
||||
"title": "modules.display.detectName",
|
||||
"description": "Set if display name should be detected and printed (if supported)",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"preciseRefreshRate": {
|
||||
"title": "modules.display.preciseRefreshRate",
|
||||
"description": "Set if decimal refresh rates should not be rounded into integers when printing",
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "common/bar.h"
|
||||
#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"
|
||||
|
||||
@@ -10,6 +12,8 @@ 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)
|
||||
@@ -30,7 +34,9 @@ void ffPrintBrightness(FFinstance* instance, FFBrightnessOptions* options)
|
||||
{
|
||||
if(options->moduleArgs.key.length == 0)
|
||||
{
|
||||
ffStrbufAppendF(&key, "%s (%s)", FF_BRIGHTNESS_MODULE_NAME, item->name.chars);
|
||||
ffStrbufAppendS(&key, FF_BRIGHTNESS_MODULE_NAME);
|
||||
if (ds->displays.length > 1)
|
||||
ffStrbufAppendF(&key, " (%s)", item->name.chars);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -39,10 +45,26 @@ void ffPrintBrightness(FFinstance* instance, FFBrightnessOptions* options)
|
||||
});
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, key.chars, 0, NULL, &options->moduleArgs.keyColor);
|
||||
printf("%.0f%%\n", item->value);
|
||||
|
||||
if (instance->config.percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
{
|
||||
ffAppendPercentBar(instance, &str, (uint8_t) (item->value + 0.5), 0, 10, 10);
|
||||
}
|
||||
|
||||
if(instance->config.percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
|
||||
{
|
||||
if(str.length > 0)
|
||||
ffStrbufAppendC(&str, ' ');
|
||||
|
||||
ffAppendPercentNum(instance, &str, (uint8_t) (item->value + 0.5), 10, 10, str.length > 0);
|
||||
}
|
||||
|
||||
ffStrbufPutTo(&str, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ void ffPrintDisplay(FFinstance* instance, FFDisplayOptions* options)
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
if((options->detectName && result->name.length) || (moduleIndex > 0 && displayType))
|
||||
if(moduleIndex > 0)
|
||||
{
|
||||
ffStrbufClear(&key);
|
||||
if(options->moduleArgs.key.length == 0)
|
||||
@@ -117,7 +117,6 @@ void ffInitDisplayOptions(FFDisplayOptions* options)
|
||||
options->moduleName = FF_DISPLAY_MODULE_NAME;
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||
options->detectName = false;
|
||||
options->preciseRefreshRate = false;
|
||||
}
|
||||
|
||||
@@ -139,12 +138,6 @@ bool ffParseDisplayCommandOptions(FFDisplayOptions* options, const char* key, co
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "detect-name"))
|
||||
{
|
||||
options->detectName = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "precise-refresh-rate"))
|
||||
{
|
||||
options->preciseRefreshRate = ffOptionParseBoolean(value);
|
||||
@@ -193,12 +186,6 @@ void ffParseDisplayJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "detectName"))
|
||||
{
|
||||
options.detectName = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "preciseRefreshRate"))
|
||||
{
|
||||
options.preciseRefreshRate = yyjson_get_bool(val);
|
||||
|
||||
@@ -17,6 +17,5 @@ typedef struct FFDisplayOptions
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFDisplayCompactType compactType;
|
||||
bool detectName;
|
||||
bool preciseRefreshRate;
|
||||
} FFDisplayOptions;
|
||||
|
||||
Reference in New Issue
Block a user