diff --git a/src/common/percent.c b/src/common/percent.c index 703ce40a3..766f610f7 100644 --- a/src/common/percent.c +++ b/src/common/percent.c @@ -3,7 +3,7 @@ #include "common/color.h" #include "util/textModifier.h" -void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow) +void ffPercentAppendBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow) { assert(green <= 100 && yellow <= 100); @@ -56,7 +56,7 @@ void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET); } -void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses) +void ffPercentAppendNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses) { assert(green <= 100 && yellow <= 100); diff --git a/src/common/percent.h b/src/common/percent.h index 43a1f49d9..f97fcb1c8 100644 --- a/src/common/percent.h +++ b/src/common/percent.h @@ -20,5 +20,5 @@ enum // [yellow, green): print yellow // [0, yellow): print red -void ffAppendPercentBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow); -void ffAppendPercentNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses); +void ffPercentAppendBar(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow); +void ffPercentAppendNum(FFstrbuf* buffer, double percent, uint8_t green, uint8_t yellow, bool parentheses); diff --git a/src/modules/battery/battery.c b/src/modules/battery/battery.c index 89d339a30..b811bdb3e 100644 --- a/src/modules/battery/battery.c +++ b/src/modules/battery/battery.c @@ -24,7 +24,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffAppendPercentBar(&str, result->capacity, 50, 20); + ffPercentAppendBar(&str, result->capacity, 50, 20); } if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) @@ -32,7 +32,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffAppendPercentNum(&str, result->capacity, 50, 20, str.length > 0); + ffPercentAppendNum(&str, result->capacity, 50, 20, str.length > 0); } } @@ -57,7 +57,7 @@ static void printBattery(FFBatteryOptions* options, FFBatteryResult* result, uin else { FF_STRBUF_AUTO_DESTROY capacityStr = ffStrbufCreate(); - ffAppendPercentNum(&capacityStr, result->capacity, 51, 21, false); + ffPercentAppendNum(&capacityStr, result->capacity, 51, 21, false); ffPrintFormat(FF_BATTERY_MODULE_NAME, index, &options->moduleArgs, 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 0d669af44..078759831 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, ' '); - ffAppendPercentNum(&buffer, device->battery, 50, 20, buffer.length > 0); + ffPercentAppendNum(&buffer, device->battery, 50, 20, buffer.length > 0); } if (!device->connected) @@ -28,7 +28,7 @@ static void printDevice(FFBluetoothOptions* options, const FFBluetoothResult* de else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffAppendPercentNum(&percentageStr, device->battery, 50, 20, false); + ffPercentAppendNum(&percentageStr, device->battery, 50, 20, false); ffPrintFormat(FF_BLUETOOTH_MODULE_NAME, index, &options->moduleArgs, 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 67074b07a..80ceb0cfd 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) { - ffAppendPercentBar(&str, percent, 100, 100); + ffPercentAppendBar(&str, percent, 100, 100); } if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) @@ -60,7 +60,7 @@ void ffPrintBrightness(FFBrightnessOptions* options) if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffAppendPercentNum(&str, percent, 100, 100, str.length > 0); + ffPercentAppendNum(&str, percent, 100, 100, str.length > 0); } ffStrbufPutTo(&str, stdout); @@ -68,7 +68,7 @@ void ffPrintBrightness(FFBrightnessOptions* options) else { FF_STRBUF_AUTO_DESTROY valueStr = ffStrbufCreate(); - ffAppendPercentNum(&valueStr, percent, 10, 10, false); + ffPercentAppendNum(&valueStr, percent, 10, 10, false); ffPrintFormatString(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/cpuusage/cpuusage.c b/src/modules/cpuusage/cpuusage.c index 85797a213..ea1a0ffeb 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) - ffAppendPercentBar(&str, avgValue, 50, 80); + ffPercentAppendBar(&str, avgValue, 50, 80); if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) { if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffAppendPercentNum(&str, avgValue, 50, 80, str.length > 0); + ffPercentAppendNum(&str, avgValue, 50, 80, str.length > 0); } } else @@ -66,7 +66,7 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options) { if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffAppendPercentNum(&str, *percent, 50, 80, false); + ffPercentAppendNum(&str, *percent, 50, 80, false); } } ffStrbufPutTo(&str, stdout); @@ -74,11 +74,11 @@ void ffPrintCPUUsage(FFCPUUsageOptions* options) else { FF_STRBUF_AUTO_DESTROY avgStr = ffStrbufCreate(); - ffAppendPercentNum(&avgStr, avgValue, 50, 80, false); + ffPercentAppendNum(&avgStr, avgValue, 50, 80, false); FF_STRBUF_AUTO_DESTROY minStr = ffStrbufCreate(); - ffAppendPercentNum(&minStr, minValue, 50, 80, false); + ffPercentAppendNum(&minStr, minValue, 50, 80, false); FF_STRBUF_AUTO_DESTROY maxStr = ffStrbufCreate(); - ffAppendPercentNum(&maxStr, maxValue, 50, 80, false); + ffPercentAppendNum(&maxStr, maxValue, 50, 80, false); ffPrintFormat(FF_CPUUSAGE_DISPLAY_NAME, 0, &options->moduleArgs, 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 69cb6333a..3bf539359 100644 --- a/src/modules/disk/disk.c +++ b/src/modules/disk/disk.c @@ -59,7 +59,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffAppendPercentBar(&str, bytesPercentage, 50, 80); + ffPercentAppendBar(&str, bytesPercentage, 50, 80); ffStrbufAppendC(&str, ' '); } @@ -68,7 +68,7 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) { - ffAppendPercentNum(&str, bytesPercentage, 50, 80, str.length > 0); + ffPercentAppendNum(&str, bytesPercentage, 50, 80, str.length > 0); ffStrbufAppendC(&str, ' '); } } @@ -104,10 +104,10 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk) else { FF_STRBUF_AUTO_DESTROY bytesPercentageStr = ffStrbufCreate(); - ffAppendPercentNum(&bytesPercentageStr, bytesPercentage, 50, 80, false); + ffPercentAppendNum(&bytesPercentageStr, bytesPercentage, 50, 80, false); FF_STRBUF_AUTO_DESTROY filesPercentageStr = ffStrbufCreate(); double filesPercentage = disk->filesTotal > 0 ? ((double) disk->filesUsed / (double) disk->filesTotal) * 100.0 : 0; - ffAppendPercentNum(&filesPercentageStr, filesPercentage, 50, 80, false); + ffPercentAppendNum(&filesPercentageStr, filesPercentage, 50, 80, false); 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 2e639b36f..34d79978d 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, ' '); - ffAppendPercentNum(&buffer, device->battery, 50, 20, buffer.length > 0); + ffPercentAppendNum(&buffer, device->battery, 50, 20, buffer.length > 0); } ffStrbufPutTo(&buffer, stdout); } else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffAppendPercentNum(&percentageStr, device->battery, 50, 20, false); + ffPercentAppendNum(&percentageStr, device->battery, 50, 20, false); ffPrintFormat(FF_GAMEPAD_MODULE_NAME, index, &options->moduleArgs, 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 588c1c14c..dd19e8614 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -60,7 +60,7 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu if(gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET) { ffStrbufAppendS(&output, ", "); - ffAppendPercentNum(&output, (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0, 50, 80, false); + ffPercentAppendNum(&output, (double) gpu->dedicated.used / (double) gpu->dedicated.total * 100.0, 50, 80, false); } ffStrbufAppendC(&output, ')'); } diff --git a/src/modules/memory/memory.c b/src/modules/memory/memory.c index bccb12e9f..ac2eea94f 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) { - ffAppendPercentBar(&str, percentage, 50, 80); + ffPercentAppendBar(&str, percentage, 50, 80); 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) - ffAppendPercentNum(&str, percentage, 50, 80, str.length > 0); + ffPercentAppendNum(&str, percentage, 50, 80, str.length > 0); ffStrbufTrimRight(&str, ' '); ffStrbufPutTo(&str, stdout); @@ -57,7 +57,7 @@ void ffPrintMemory(FFMemoryOptions* options) else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffAppendPercentNum(&percentageStr, percentage, 50, 80, false); + ffPercentAppendNum(&percentageStr, percentage, 50, 80, false); ffPrintFormat(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_MEMORY_NUM_FORMAT_ARGS, (FFformatarg[]){ {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty}, {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty}, diff --git a/src/modules/sound/sound.c b/src/modules/sound/sound.c index 54ea63927..a7665865b 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, ' '); - ffAppendPercentBar(&str, device->volume, 80, 90); + ffPercentAppendBar(&str, device->volume, 80, 90); } 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, ' '); - ffAppendPercentNum(&str, device->volume, 80, 90, str.length > 0); + ffPercentAppendNum(&str, device->volume, 80, 90, str.length > 0); } } @@ -47,7 +47,7 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffAppendPercentNum(&percentageStr, device->volume, 80, 90, false); + ffPercentAppendNum(&percentageStr, device->volume, 80, 90, false); ffPrintFormat(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, 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 2635c8d00..cfc1e36cb 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) { - ffAppendPercentBar(&str, 0, 50, 80); + ffPercentAppendBar(&str, 0, 50, 80); ffStrbufAppendC(&str, ' '); } if(!(instance.config.display.percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT)) ffStrbufAppendS(&str, "Disabled"); else - ffAppendPercentNum(&str, 0, 50, 80, str.length > 0); + ffPercentAppendNum(&str, 0, 50, 80, str.length > 0); } else { if(instance.config.display.percentType & FF_PERCENTAGE_TYPE_BAR_BIT) { - ffAppendPercentBar(&str, percentage, 50, 80); + ffPercentAppendBar(&str, percentage, 50, 80); 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) - ffAppendPercentNum(&str, percentage, 50, 80, str.length > 0); + ffPercentAppendNum(&str, percentage, 50, 80, str.length > 0); } ffStrbufTrimRight(&str, ' '); @@ -66,7 +66,7 @@ void ffPrintSwap(FFSwapOptions* options) else { FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate(); - ffAppendPercentNum(&percentageStr, percentage, 50, 80, false); + ffPercentAppendNum(&percentageStr, percentage, 50, 80, false); ffPrintFormat(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_SWAP_NUM_FORMAT_ARGS, (FFformatarg[]){ {FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty}, {FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},