summaryrefslogtreecommitdiffstats
path: root/src/options/display.h
diff options
context:
space:
mode:
authorsumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
committersumuel <samuel@yakubos.org>2026-08-17 20:44:55 +0000
commit76424950e373d3b04ac3dd13019151bfba3e8423 (patch)
tree4c3cfdbda039e592b9186be3e28f8d7cfd439e8a /src/options/display.h
Add the files
Diffstat (limited to 'src/options/display.h')
-rw-r--r--src/options/display.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/src/options/display.h b/src/options/display.h
new file mode 100644
index 0000000..8c674ea
--- /dev/null
+++ b/src/options/display.h
@@ -0,0 +1,97 @@
+#pragma once
+
+#include "common/ffdata.h"
+#include "common/percent.h"
+#include "common/FFstrbuf.h"
+#include "common/FFlist.h"
+
+typedef enum FF_A_PACKED FFSizeBinaryPrefixType {
+ FF_SIZE_BINARY_PREFIX_TYPE_IEC, // 1024 Bytes = 1 KiB, 1024 KiB = 1 MiB, ... (standard)
+ FF_SIZE_BINARY_PREFIX_TYPE_SI, // 1000 Bytes = 1 kB, 1000 kB = 1 MB, ...
+ FF_SIZE_BINARY_PREFIX_TYPE_JEDEC, // 1024 Bytes = 1 KB, 1024 KB = 1 MB, ...
+} FFSizeBinaryPrefixType;
+
+typedef enum FF_A_PACKED FFTemperatureUnit {
+ FF_TEMPERATURE_UNIT_DEFAULT,
+ FF_TEMPERATURE_UNIT_CELSIUS,
+ FF_TEMPERATURE_UNIT_FAHRENHEIT,
+ FF_TEMPERATURE_UNIT_KELVIN,
+} FFTemperatureUnit;
+
+typedef enum FF_A_PACKED FFSpaceBeforeUnitType {
+ FF_SPACE_BEFORE_UNIT_DEFAULT,
+ FF_SPACE_BEFORE_UNIT_ALWAYS,
+ FF_SPACE_BEFORE_UNIT_NEVER,
+} FFSpaceBeforeUnitType;
+
+typedef enum FF_A_PACKED FFFractionTrailingZerosType {
+ FF_FRACTION_TRAILING_ZEROS_TYPE_DEFAULT,
+ FF_FRACTION_TRAILING_ZEROS_TYPE_ALWAYS,
+ FF_FRACTION_TRAILING_ZEROS_TYPE_NEVER,
+} FFFractionTrailingZerosType;
+
+typedef struct FFOptionsDisplay {
+ // If one of those is empty, ffLogoPrint will set them
+ FFstrbuf colorKeys;
+ FFstrbuf colorTitle;
+ FFstrbuf colorOutput;
+ FFstrbuf colorSeparator;
+
+ bool brightColor;
+
+ FFstrbuf keyValueSeparator;
+
+ int32_t stat; // <0: disable stat; 0: no threshold; >0: threshold in ms
+ bool pipe; // disables all escape sequences
+ bool showErrors;
+#ifndef NDEBUG
+ bool debugMode;
+#endif
+ bool disableLinewrap;
+ bool durationAbbreviation;
+ FFSpaceBeforeUnitType durationSpaceBeforeUnit;
+ bool hideCursor;
+ FFSizeBinaryPrefixType sizeBinaryPrefix;
+ uint8_t sizeNdigits;
+ uint8_t sizeMaxPrefix;
+ FFSpaceBeforeUnitType sizeSpaceBeforeUnit;
+ FFTemperatureUnit tempUnit;
+ uint8_t tempNdigits;
+ FFstrbuf tempColorGreen;
+ FFstrbuf tempColorYellow;
+ FFstrbuf tempColorRed;
+ FFSpaceBeforeUnitType tempSpaceBeforeUnit;
+ FFstrbuf barCharElapsed;
+ FFstrbuf barCharTotal;
+ FFstrbuf barBorderLeft;
+ FFstrbuf barBorderRight;
+ FFstrbuf barBorderLeftElapsed;
+ FFstrbuf barBorderRightElapsed;
+ FFstrbuf barColorElapsed; // "auto" for auto selection from percent config; empty for no custom color (inherits)
+ FFstrbuf barColorTotal; // empty for no custom color (inherits)
+ FFstrbuf barColorBorder; // empty for no custom color (inherits)
+ uint8_t barWidth;
+ FFPercentageTypeFlags percentType;
+ uint8_t percentNdigits;
+ FFstrbuf percentColorGreen;
+ FFstrbuf percentColorYellow;
+ FFstrbuf percentColorRed;
+ FFSpaceBeforeUnitType percentSpaceBeforeUnit;
+ uint8_t percentWidth;
+ bool noBuffer;
+ FFModuleKeyType keyType;
+ uint16_t keyWidth;
+ uint16_t keyPaddingLeft;
+ int8_t freqNdigits;
+ FFSpaceBeforeUnitType freqSpaceBeforeUnit;
+ int8_t fractionNdigits;
+ FFFractionTrailingZerosType fractionTrailingZeros;
+
+ FFlist constants; // list of FFstrbuf
+} FFOptionsDisplay;
+
+const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_val* root);
+bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key, const char* value);
+void ffOptionsInitDisplay(FFOptionsDisplay* options);
+void ffOptionsDestroyDisplay(FFOptionsDisplay* options);
+void ffOptionsGenerateDisplayJsonConfig(FFdata* data, FFOptionsDisplay* options);