From 459f159b1b597e1cd35d73ecc09c5f4a950be627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 8 May 2024 15:25:59 +0800 Subject: [PATCH] Fastfetch: revert to module color after printing custom colors --- src/common/percent.c | 18 +++++++++++++++--- src/common/percent.h | 5 +++-- src/common/temps.c | 8 +++++++- src/common/temps.h | 3 ++- src/modules/battery/battery.c | 10 +++++----- src/modules/bluetooth/bluetooth.c | 4 ++-- src/modules/brightness/brightness.c | 6 +++--- src/modules/cpu/cpu.c | 4 ++-- src/modules/cpuusage/cpuusage.c | 12 ++++++------ src/modules/disk/disk.c | 8 ++++---- src/modules/gamepad/gamepad.c | 4 ++-- src/modules/gpu/gpu.c | 6 +++--- src/modules/memory/memory.c | 6 +++--- src/modules/physicaldisk/physicaldisk.c | 4 ++-- src/modules/sound/sound.c | 6 +++--- src/modules/swap/swap.c | 10 +++++----- 16 files changed, 67 insertions(+), 47 deletions(-) diff --git a/src/common/percent.c b/src/common/percent.c index a80f3ed10..14ab93f55 100644 --- a/src/common/percent.c +++ b/src/common/percent.c @@ -6,7 +6,15 @@ #include "util/textModifier.h" #include "util/stringUtils.h" -void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config) +static void appendOutputColor(FFstrbuf* buffer, const FFModuleArgs* module) +{ + if (module->outputColor.length) + ffStrbufAppendF(buffer, "\e[%sm", module->outputColor.chars); + else if (instance.config.display.colorOutput.length) + ffStrbufAppendF(buffer, "\e[%sm", instance.config.display.colorOutput.chars); +} + +void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module) { uint8_t green = config.green, yellow = config.yellow; assert(green <= 100 && yellow <= 100); @@ -66,16 +74,19 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig con if(options->barBorder) { if(!options->pipe) - ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m ]"); + ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_WHITE "m ]");\ else ffStrbufAppendS(buffer, " ]"); } if(!options->pipe) + { ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET); + appendOutputColor(buffer, module); + } } -void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses) +void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module) { uint8_t green = config.green, yellow = config.yellow; assert(green <= 100 && yellow <= 100); @@ -120,6 +131,7 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig con if (colored && !options->pipe) { ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET); + appendOutputColor(buffer, module); } if (parentheses) diff --git a/src/common/percent.h b/src/common/percent.h index 6d7c6b2e8..8ae87708c 100644 --- a/src/common/percent.h +++ b/src/common/percent.h @@ -2,6 +2,7 @@ #include "util/FFstrbuf.h" #include "common/parsing.h" +#include "common/option.h" enum { @@ -21,8 +22,8 @@ enum // [yellow, green): print yellow // [0, yellow): print red -void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config); -void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses); +void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config, const FFModuleArgs* module); +void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses, const FFModuleArgs* module); typedef struct yyjson_val yyjson_val; typedef struct yyjson_mut_doc yyjson_mut_doc; diff --git a/src/common/temps.c b/src/common/temps.c index d72f46f0e..09eb955d7 100644 --- a/src/common/temps.c +++ b/src/common/temps.c @@ -3,7 +3,7 @@ #include "util/textModifier.h" #include "util/stringUtils.h" -void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config) +void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config, const FFModuleArgs* module) { if (celsius != celsius) // ignores NaN return; @@ -51,7 +51,13 @@ void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig confi } if (!options->pipe) + { ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET); + if (module->outputColor.length) + ffStrbufAppendF(buffer, "\e[%sm", module->outputColor.chars); + else if (instance.config.display.colorOutput.length) + ffStrbufAppendF(buffer, "\e[%sm", instance.config.display.colorOutput.chars); + } } bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config) diff --git a/src/common/temps.h b/src/common/temps.h index bbbc74766..2236713d2 100644 --- a/src/common/temps.h +++ b/src/common/temps.h @@ -1,8 +1,9 @@ #pragma once #include "common/parsing.h" +#include "common/option.h" -void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config); +void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config, const FFModuleArgs* module); bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config); bool ffTempsParseJsonObject(const char* key, yyjson_val* value, bool* useTemp, FFColorRangeConfig* config); void ffTempsGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF_MAYBE_UNUSED bool defaultTemp, FFColorRangeConfig defaultConfig, bool temp, FFColorRangeConfig config); diff --git a/src/modules/battery/battery.c b/src/modules/battery/battery.c index ee82e42d5..918fc7819 100644 --- a/src/modules/battery/battery.c +++ b/src/modules/battery/battery.c @@ -25,7 +25,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffPercentAppendBar(&str, result->capacity, options->percent); + ffPercentAppendBar(&str, result->capacity, options->percent, &options->moduleArgs); } if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) @@ -33,7 +33,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffPercentAppendNum(&str, result->capacity, options->percent, str.length > 0); + ffPercentAppendNum(&str, result->capacity, options->percent, str.length > 0, &options->moduleArgs); } } @@ -50,7 +50,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin if(str.length > 0) ffStrbufAppendS(&str, " - "); - ffTempsAppendNum(result->temperature, &str, options->tempConfig); + ffTempsAppendNum(result->temperature, &str, options->tempConfig, &options->moduleArgs); } ffStrbufPutTo(&str, stdout); @@ -58,9 +58,9 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin else { FF_STRBUF_AUTO_DESTROY capacityStr = ffStrbufCreate(); - ffPercentAppendNum(&capacityStr, result->capacity, options->percent, false); + ffPercentAppendNum(&capacityStr, result->capacity, options->percent, false, &options->moduleArgs); FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate(); - ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig); + ffTempsAppendNum(result->temperature, &tempStr, options->tempConfig, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_BATTERY_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BATTERY_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer}, {FF_FORMAT_ARG_TYPE_STRBUF, &result->modelName}, diff --git a/src/modules/bluetooth/bluetooth.c b/src/modules/bluetooth/bluetooth.c index c638252e7..6beef48b7 100644 --- a/src/modules/bluetooth/bluetooth.c +++ b/src/modules/bluetooth/bluetooth.c @@ -19,7 +19,7 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de { if (buffer.length) ffStrbufAppendC(&buffer, ' '); - ffPercentAppendNum(&buffer, device->battery, options->percent, buffer.length > 0); + ffPercentAppendNum(&buffer, device->battery, options->percent, buffer.length > 0, &options->moduleArgs); } if (!device->connected) @@ -30,7 +30,7 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffPercentAppendNum(&percentageStr, device->battery, options->percent, false); + ffPercentAppendNum(&percentageStr, device->battery, options->percent, false, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_BLUETOOTH_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_BLUETOOTH_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &device->name}, diff --git a/src/modules/brightness/brightness.c b/src/modules/brightness/brightness.c index f5defe068..8e2aff84d 100644 --- a/src/modules/brightness/brightness.c +++ b/src/modules/brightness/brightness.c @@ -52,7 +52,7 @@ void ffPrintBrightness(FFBrightnessOptions* options) if (instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffPercentAppendBar(&str, percent, options->percent); + ffPercentAppendBar(&str, percent, options->percent, &options->moduleArgs); } if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) @@ -60,7 +60,7 @@ void ffPrintBrightness(FFBrightnessOptions* options) if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffPercentAppendNum(&str, percent, options->percent, str.length > 0); + ffPercentAppendNum(&str, percent, options->percent, str.length > 0, &options->moduleArgs); } ffStrbufPutTo(&str, stdout); @@ -68,7 +68,7 @@ void ffPrintBrightness(FFBrightnessOptions* options) else { FF_STRBUF_AUTO_DESTROY valueStr = ffStrbufCreate(); - ffPercentAppendNum(&valueStr, percent, options->percent, false); + ffPercentAppendNum(&valueStr, percent, options->percent, false, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_BRIGHTNESS_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &valueStr}, {FF_FORMAT_ARG_TYPE_STRBUF, &item->name}, diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c index 5da296f30..43ec9fe9a 100644 --- a/src/modules/cpu/cpu.c +++ b/src/modules/cpu/cpu.c @@ -57,7 +57,7 @@ void ffPrintCPU(FFCPUOptions* options) if(cpu.temperature == cpu.temperature) //FF_CPU_TEMP_UNSET { ffStrbufAppendS(&str, " - "); - ffTempsAppendNum(cpu.temperature, &str, options->tempConfig); + ffTempsAppendNum(cpu.temperature, &str, options->tempConfig, &options->moduleArgs); } ffStrbufPutTo(&str, stdout); @@ -65,7 +65,7 @@ void ffPrintCPU(FFCPUOptions* options) else { FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate(); - ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig); + ffTempsAppendNum(cpu.temperature, &tempStr, options->tempConfig, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPU_NUM_FORMAT_ARGS, ((FFformatarg[]){ {FF_FORMAT_ARG_TYPE_STRBUF, &cpu.name}, {FF_FORMAT_ARG_TYPE_STRBUF, &cpu.vendor}, diff --git a/src/modules/cpuusage/cpuusage.c b/src/modules/cpuusage/cpuusage.c index 0909763f7..aa3bfccac 100644 --- a/src/modules/cpuusage/cpuusage.c +++ b/src/modules/cpuusage/cpuusage.c @@ -52,12 +52,12 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options) if (!options->separate) { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) - ffPercentAppendBar(&str, avgValue, options->percent); + ffPercentAppendBar(&str, avgValue, options->percent, &options->moduleArgs); if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) { if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffPercentAppendNum(&str, avgValue, options->percent, str.length > 0); + ffPercentAppendNum(&str, avgValue, options->percent, str.length > 0, &options->moduleArgs); } } else @@ -66,7 +66,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options) { if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffPercentAppendNum(&str, *percent, options->percent, false); + ffPercentAppendNum(&str, *percent, options->percent, false, &options->moduleArgs); } } ffStrbufPutTo(&str, stdout); @@ -74,11 +74,11 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options) else { FF_STRBUF_AUTO_DESTROY avgStr = ffStrbufCreate(); - ffPercentAppendNum(&avgStr, avgValue, options->percent, false); + ffPercentAppendNum(&avgStr, avgValue, options->percent, false, &options->moduleArgs); FF_STRBUF_AUTO_DESTROY minStr = ffStrbufCreate(); - ffPercentAppendNum(&minStr, minValue, options->percent, false); + ffPercentAppendNum(&minStr, minValue, options->percent, false, &options->moduleArgs); FF_STRBUF_AUTO_DESTROY maxStr = ffStrbufCreate(); - ffPercentAppendNum(&maxStr, maxValue, options->percent, false); + ffPercentAppendNum(&maxStr, maxValue, options->percent, false, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_CPUUSAGE_NUM_FORMAT_ARGS, ((FFformatarg[]){ {FF_FORMAT_ARG_TYPE_STRBUF, &avgStr}, {FF_FORMAT_ARG_TYPE_STRBUF, &maxStr}, diff --git a/src/modules/disk/disk.c b/src/modules/disk/disk.c index e44290479..8942754be 100644 --- a/src/modules/disk/disk.c +++ b/src/modules/disk/disk.c @@ -60,7 +60,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffPercentAppendBar(&str, bytesPercentage, options->percent); + ffPercentAppendBar(&str, bytesPercentage, options->percent, &options->moduleArgs); ffStrbufAppendC(&str, ' '); } @@ -69,7 +69,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) { - ffPercentAppendNum(&str, bytesPercentage, options->percent, str.length > 0); + ffPercentAppendNum(&str, bytesPercentage, options->percent, str.length > 0, &options->moduleArgs); ffStrbufAppendC(&str, ' '); } } @@ -105,10 +105,10 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) else { FF_STRBUF_AUTO_DESTROY bytesPercentageStr = ffStrbufCreate(); - ffPercentAppendNum(&bytesPercentageStr, bytesPercentage, options->percent, false); + ffPercentAppendNum(&bytesPercentageStr, bytesPercentage, options->percent, false, &options->moduleArgs); FF_STRBUF_AUTO_DESTROY filesPercentageStr = ffStrbufCreate(); double filesPercentage = disk->filesTotal > 0 ? ((double) disk->filesUsed / (double) disk->filesTotal) * 100.0 : 0; - ffPercentAppendNum(&filesPercentageStr, filesPercentage, options->percent, false); + ffPercentAppendNum(&filesPercentageStr, filesPercentage, options->percent, false, &options->moduleArgs); bool isExternal = !!(disk->type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT); bool isHidden = !!(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT); diff --git a/src/modules/gamepad/gamepad.c b/src/modules/gamepad/gamepad.c index d14beb279..bc5417d58 100644 --- a/src/modules/gamepad/gamepad.c +++ b/src/modules/gamepad/gamepad.c @@ -19,14 +19,14 @@ static void printDevice(FFGamepadOptions* options, const FFGamepadDevice* device { if (buffer.length) ffStrbufAppendC(&buffer, ' '); - ffPercentAppendNum(&buffer, device->battery, options->percent, buffer.length > 0); + ffPercentAppendNum(&buffer, device->battery, options->percent, buffer.length > 0, &options->moduleArgs); } ffStrbufPutTo(&buffer, stdout); } else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffPercentAppendNum(&percentageStr, device->battery, options->percent, false); + ffPercentAppendNum(&percentageStr, device->battery, options->percent, false, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_GAMEPAD_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GAMEPAD_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &device->name}, diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index aa63b16dd..47d9fa91e 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -45,7 +45,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu if(gpu->temperature == gpu->temperature) //FF_GPU_TEMP_UNSET { ffStrbufAppendS(&output, " - "); - ffTempsAppendNum(gpu->temperature, &output, options->tempConfig); + ffTempsAppendNum(gpu->temperature, &output, options->tempConfig, &options->moduleArgs); } if(gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET && gpu->dedicated.total != 0) @@ -61,7 +61,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu if(gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET) { ffStrbufAppendS(&output, ", "); - ffPercentAppendNum(&output, (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0, options->percent, false); + ffPercentAppendNum(&output, (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0, options->percent, false, &options->moduleArgs); } ffStrbufAppendC(&output, ')'); } @@ -74,7 +74,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu else { FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate(); - ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig); + ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor}, {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name}, diff --git a/src/modules/memory/memory.c b/src/modules/memory/memory.c index 52ec97939..9f143d0aa 100644 --- a/src/modules/memory/memory.c +++ b/src/modules/memory/memory.c @@ -40,7 +40,7 @@ void ffPrintMemory(FFMemoryOptions* options) if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffPercentAppendBar(&str, percentage, options->percent); + ffPercentAppendBar(&str, percentage, options->percent, &options->moduleArgs); ffStrbufAppendC(&str, ' '); } @@ -48,7 +48,7 @@ void ffPrintMemory(FFMemoryOptions* options) ffStrbufAppendF(&str, "%s / %s ", usedPretty.chars, totalPretty.chars); if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) - ffPercentAppendNum(&str, percentage, options->percent, str.length > 0); + ffPercentAppendNum(&str, percentage, options->percent, str.length > 0, &options->moduleArgs); ffStrbufTrimRight(&str, ' '); ffStrbufPutTo(&str, stdout); @@ -57,7 +57,7 @@ void ffPrintMemory(FFMemoryOptions* options) else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffPercentAppendNum(&percentageStr, percentage, options->percent, false); + ffPercentAppendNum(&percentageStr, percentage, options->percent, false, &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_TYPE_STRBUF, &usedPretty}, {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty}, diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 0b9eff49e..73380bcdf 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -97,14 +97,14 @@ void ffPrintPhysicalDisk(FFPhysicalDiskOptions* options) if(buffer.length > 0) ffStrbufAppendS(&buffer, " - "); - ffTempsAppendNum(dev->temperature, &buffer, options->tempConfig); + ffTempsAppendNum(dev->temperature, &buffer, options->tempConfig, &options->moduleArgs); } ffStrbufPutTo(&buffer, stdout); } else { FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate(); - ffTempsAppendNum(dev->temperature, &tempStr, options->tempConfig); + ffTempsAppendNum(dev->temperature, &tempStr, options->tempConfig, &options->moduleArgs); if (dev->type & FF_PHYSICALDISK_TYPE_READWRITE) readOnlyType = "Read-write"; FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_PHYSICALDISK_NUM_FORMAT_ARGS, ((FFformatarg[]){ diff --git a/src/modules/sound/sound.c b/src/modules/sound/sound.c index 0cea6b4e0..9b9437be9 100644 --- a/src/modules/sound/sound.c +++ b/src/modules/sound/sound.c @@ -24,7 +24,7 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui if (str.length) ffStrbufAppendC(&str, ' '); - ffPercentAppendBar(&str, device->volume, options->percent); + ffPercentAppendBar(&str, device->volume, options->percent, &options->moduleArgs); } if (instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) @@ -32,7 +32,7 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui if (str.length) ffStrbufAppendC(&str, ' '); - ffPercentAppendNum(&str, device->volume, options->percent, str.length > 0); + ffPercentAppendNum(&str, device->volume, options->percent, str.length > 0, &options->moduleArgs); } } @@ -47,7 +47,7 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffPercentAppendNum(&percentageStr, device->volume, options->percent, false); + ffPercentAppendNum(&percentageStr, device->volume, options->percent, false, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SOUND_NUM_FORMAT_ARGS, ((FFformatarg[]) { {FF_FORMAT_ARG_TYPE_BOOL, &device->main}, diff --git a/src/modules/swap/swap.c b/src/modules/swap/swap.c index 36b4c8df6..4b68c4709 100644 --- a/src/modules/swap/swap.c +++ b/src/modules/swap/swap.c @@ -37,19 +37,19 @@ void ffPrintSwap(FFSwapOptions* options) { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffPercentAppendBar(&str, 0, options->percent); + ffPercentAppendBar(&str, 0, options->percent, &options->moduleArgs); ffStrbufAppendC(&str, ' '); } if(!(instance.config.display.percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT)) ffStrbufAppendS(&str, "Disabled"); else - ffPercentAppendNum(&str, 0, options->percent, str.length > 0); + ffPercentAppendNum(&str, 0, options->percent, str.length > 0, &options->moduleArgs); } else { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffPercentAppendBar(&str, percentage, options->percent); + ffPercentAppendBar(&str, percentage, options->percent, &options->moduleArgs); ffStrbufAppendC(&str, ' '); } @@ -57,7 +57,7 @@ void ffPrintSwap(FFSwapOptions* options) ffStrbufAppendF(&str, "%s / %s ", usedPretty.chars, totalPretty.chars); if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) - ffPercentAppendNum(&str, percentage, options->percent, str.length > 0); + ffPercentAppendNum(&str, percentage, options->percent, str.length > 0, &options->moduleArgs); } ffStrbufTrimRight(&str, ' '); @@ -66,7 +66,7 @@ void ffPrintSwap(FFSwapOptions* options) else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffPercentAppendNum(&percentageStr, percentage, options->percent, false); + ffPercentAppendNum(&percentageStr, percentage, options->percent, false, &options->moduleArgs); FF_PRINT_FORMAT_CHECKED(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SWAP_NUM_FORMAT_ARGS, ((FFformatarg[]){ {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty}, {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},