mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
Percent: in custom format, only set num and bar string if enabled in percent config
Also fix `percentage-bar` printing in Brightness module
This commit is contained in:
@@ -29,6 +29,7 @@ void ffPrintMemory(FFMemoryOptions* options)
|
||||
? 0
|
||||
: (double) storage.bytesUsed / (double) storage.bytesTotal * 100.0;
|
||||
|
||||
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
@@ -37,7 +38,6 @@ void ffPrintMemory(FFMemoryOptions* options)
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
|
||||
|
||||
if(percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
{
|
||||
@@ -58,9 +58,12 @@ void ffPrintMemory(FFMemoryOptions* options)
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY percentageNum = ffStrbufCreate();
|
||||
ffPercentAppendNum(&percentageNum, percentage, options->percent, false, &options->moduleArgs);
|
||||
if (percentType & FF_PERCENTAGE_TYPE_NUM_BIT)
|
||||
ffPercentAppendNum(&percentageNum, percentage, options->percent, false, &options->moduleArgs);
|
||||
FF_STRBUF_AUTO_DESTROY percentageBar = ffStrbufCreate();
|
||||
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
|
||||
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
|
||||
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
|
||||
|
||||
FF_PRINT_FORMAT_CHECKED(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]){
|
||||
FF_FORMAT_ARG(usedPretty, "used"),
|
||||
FF_FORMAT_ARG(totalPretty, "total"),
|
||||
|
||||
Reference in New Issue
Block a user