mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Display: print * for primary monitors
Also `FF_FORMAT_ARG_VALUE_BOOL` was removed, which makes usages of `FF_FORMAT_ARG_VALUE_*` inconsistant
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg)
|
||||
else if(formatarg->type == FF_FORMAT_ARG_TYPE_DOUBLE)
|
||||
ffStrbufAppendF(buffer, "%g", *(double*)formatarg->value);
|
||||
else if(formatarg->type == FF_FORMAT_ARG_TYPE_BOOL)
|
||||
ffStrbufAppendS(buffer, formatarg->value != NULL ? "true" : "false");
|
||||
ffStrbufAppendS(buffer, *(bool*)formatarg->value ? "true" : "false");
|
||||
else if(formatarg->type == FF_FORMAT_ARG_TYPE_LIST)
|
||||
{
|
||||
const FFlist* list = formatarg->value;
|
||||
|
||||
@@ -27,6 +27,4 @@ typedef struct FFformatarg
|
||||
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
||||
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
||||
|
||||
#define FF_FORMAT_ARG_VALUE_BOOL(xpr) ((xpr) ? (const void*) 1 : NULL)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -76,6 +76,8 @@ static void printDisk(FFinstance* instance, FFDiskOptions* options, const FFDisk
|
||||
{
|
||||
uint8_t filesPercentage = disk->filesTotal > 0 ? (uint8_t) (((double) disk->filesUsed / (double) disk->filesTotal) * 100.0) : 0;
|
||||
|
||||
bool isExternal = !!(disk->type & FF_DISK_TYPE_EXTERNAL_BIT);
|
||||
bool isHidden = !!(disk->type & FF_DISK_TYPE_HIDDEN_BIT);
|
||||
ffPrintFormatString(instance, key.chars, 0, NULL, &options->moduleArgs.outputFormat, FF_DISK_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},
|
||||
@@ -83,8 +85,8 @@ static void printDisk(FFinstance* instance, FFDiskOptions* options, const FFDisk
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesUsed},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &disk->filesTotal},
|
||||
{FF_FORMAT_ARG_TYPE_UINT8, &filesPercentage},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, FF_FORMAT_ARG_VALUE_BOOL(disk->type & FF_DISK_TYPE_EXTERNAL_BIT)},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, FF_FORMAT_ARG_VALUE_BOOL(disk->type & FF_DISK_TYPE_HIDDEN_BIT)},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &isExternal},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &isHidden},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->filesystem},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name}
|
||||
});
|
||||
|
||||
@@ -89,6 +89,9 @@ void ffPrintDisplay(FFinstance* instance, FFDisplayOptions* options)
|
||||
result->scaledHeight > 0 && result->scaledHeight != result->height)
|
||||
printf(" (as %ix%i)", result->scaledWidth, result->scaledHeight);
|
||||
|
||||
if(moduleIndex > 0 && result->primary)
|
||||
printf(" *");
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
@@ -102,6 +105,7 @@ void ffPrintDisplay(FFinstance* instance, FFDisplayOptions* options)
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
|
||||
{FF_FORMAT_ARG_TYPE_STRING, displayType},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &result->rotation},
|
||||
{FF_FORMAT_ARG_TYPE_BOOL, &result->primary},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user