Percentage: prepare to make threshold configurable

This commit is contained in:
李通洲
2024-01-20 14:10:13 +08:00
parent e7974a7cea
commit 62ca495155
22 changed files with 78 additions and 38 deletions
+2 -1
View File
@@ -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, ", ");
ffPercentAppendNum(&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, options->percent, false);
}
ffStrbufAppendC(&output, ')');
}
@@ -363,6 +363,7 @@ void ffInitGPUOptions(FFGPUOptions* options)
options->forceVulkan = false;
options->temp = false;
options->hideType = FF_GPU_TYPE_UNKNOWN;
options->percent = (FFPercentConfig) { 50, 80 };
}
void ffDestroyGPUOptions(FFGPUOptions* options)
+2
View File
@@ -3,6 +3,7 @@
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
#include "common/option.h"
#include "common/percent.h"
typedef enum FFGPUType
{
@@ -20,4 +21,5 @@ typedef struct FFGPUOptions
bool temp;
bool driverSpecific;
bool forceVulkan;
FFPercentConfig percent;
} FFGPUOptions;