mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Battery: fix Intel compatibility
`MaxCapacity` on Intel MBP is not 100
This commit is contained in:
@@ -26,13 +26,13 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results)
|
||||
continue;
|
||||
}
|
||||
|
||||
int intValue;
|
||||
bool boolValue;
|
||||
|
||||
BatteryResult* battery = ffListAdd(results);
|
||||
ffStrbufInit(&battery->capacity);
|
||||
if(ffCfDictGetInt(properties, "CurrentCapacity", &intValue))
|
||||
ffStrbufAppendF(&battery->capacity, "%d", intValue);
|
||||
int currentCapacity, maxCapacity;
|
||||
if(ffCfDictGetInt(properties, "CurrentCapacity", ¤tCapacity) && ffCfDictGetInt(properties, "MaxCapacity", &maxCapacity))
|
||||
ffStrbufAppendF(&battery->capacity, "%.0f", currentCapacity * 100.0 / maxCapacity);
|
||||
|
||||
ffStrbufInit(&battery->manufacturer);
|
||||
ffStrbufInit(&battery->modelName);
|
||||
|
||||
@@ -78,10 +78,7 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results) {
|
||||
if(instance->config.batteryDir.length > 0)
|
||||
{
|
||||
ffStrbufAppend(&baseDir, &instance->config.batteryDir);
|
||||
if (!ffStrbufEndsWithC(&baseDir, '/'))
|
||||
{
|
||||
ffStrbufAppendC(&baseDir, '/');
|
||||
}
|
||||
ffStrbufEnsureEndsWithC(&baseDir, '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user