mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 00:03:58 +01:00
Modules: refactor module option handling for static allocation
Moves module option structs out of global config and removes dynamic allocation, using static buffers and size assertions for safer, simpler management. Refactors module initialization and destruction to work with isolated option structs, eliminating the need for the previous modules container and related code. Unifies module option header usage and updates detection logic to leverage statically-sized option buffers, improving encapsulation and maintainability. Simplifies module function signatures and reduces coupling between modules and config. Enhances future extensibility and reliability by enforcing max size constraints and removing unnecessary indirections.
This commit is contained in:
@@ -245,6 +245,23 @@ void ffGenerateBatteryJsonResult(FFBatteryOptions* options, yyjson_mut_doc* doc,
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
|
||||
#ifdef _WIN32
|
||||
options->useSetupApi = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ffDestroyBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBatteryModuleInfo = {
|
||||
.name = FF_BATTERY_MODULE_NAME,
|
||||
.description = "Print battery capacity, status, etc",
|
||||
@@ -272,21 +289,3 @@ FFModuleBaseInfo ffBatteryModuleInfo = {
|
||||
{"Battery time remaining (formatted)", "time-formatted"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBatteryModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
|
||||
#ifdef _WIN32
|
||||
options->useSetupApi = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ffDestroyBatteryOptions(FFBatteryOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BATTERY_MODULE_NAME "Battery"
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef struct FFBatteryOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool temp;
|
||||
@@ -18,3 +15,5 @@ typedef struct FFBatteryOptions
|
||||
bool useSetupApi;
|
||||
#endif
|
||||
} FFBatteryOptions;
|
||||
|
||||
static_assert(sizeof(FFBatteryOptions) <= FF_OPTION_MAX_SIZE, "FFBatteryOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -128,6 +128,16 @@ exit:
|
||||
ffStrbufDestroy(&bios.type);
|
||||
}
|
||||
|
||||
void ffInitBiosOptions(FFBiosOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBiosOptions(FFBiosOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBiosModuleInfo = {
|
||||
.name = FF_BIOS_MODULE_NAME,
|
||||
.description = "Print information of 1st-stage bootloader (name, version, release date, etc)",
|
||||
@@ -145,14 +155,3 @@ FFModuleBaseInfo ffBiosModuleInfo = {
|
||||
{"Firmware type", "type"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBiosOptions(FFBiosOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBiosModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBiosOptions(FFBiosOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BIOS_MODULE_NAME "BIOS"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFBiosOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBiosOptions;
|
||||
|
||||
static_assert(sizeof(FFBiosOptions) <= FF_OPTION_MAX_SIZE, "FFBiosOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -163,6 +163,18 @@ void ffGenerateBluetoothJsonResult(FFBluetoothOptions* options, yyjson_mut_doc*
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->showDisconnected = false;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBluetoothModuleInfo = {
|
||||
.name = FF_BLUETOOTH_MODULE_NAME,
|
||||
.description = "List (connected) bluetooth devices",
|
||||
@@ -181,16 +193,3 @@ FFModuleBaseInfo ffBluetoothModuleInfo = {
|
||||
{"Battery percentage bar", "battery-percentage-bar"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBluetoothOptions(FFBluetoothOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBluetoothModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->showDisconnected = false;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyBluetoothOptions(FFBluetoothOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BLUETOOTH_MODULE_NAME "Bluetooth"
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef struct FFBluetoothOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool showDisconnected;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFBluetoothOptions;
|
||||
|
||||
static_assert(sizeof(FFBluetoothOptions) <= FF_OPTION_MAX_SIZE, "FFBluetoothOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -166,6 +166,16 @@ void ffGenerateBluetoothRadioJsonResult(FF_MAYBE_UNUSED FFBluetoothRadioOptions*
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitBluetoothRadioOptions(FFBluetoothRadioOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBluetoothRadioOptions(FFBluetoothRadioOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBluetoothRadioModuleInfo = {
|
||||
.name = FF_BLUETOOTHRADIO_MODULE_NAME,
|
||||
.description = "List bluetooth radios width supported version and vendor",
|
||||
@@ -186,14 +196,3 @@ FFModuleBaseInfo ffBluetoothRadioModuleInfo = {
|
||||
{"Connectable / Pairable", "connectable"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBluetoothRadioOptions(FFBluetoothRadioOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBluetoothRadioModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBluetoothRadioOptions(FFBluetoothRadioOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BLUETOOTHRADIO_MODULE_NAME "BluetoothRadio"
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef struct FFBluetoothRadioOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBluetoothRadioOptions;
|
||||
|
||||
static_assert(sizeof(FFBluetoothRadioOptions) <= FF_OPTION_MAX_SIZE, "FFBluetoothRadioOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -106,6 +106,16 @@ exit:
|
||||
ffStrbufDestroy(&board.serial);
|
||||
}
|
||||
|
||||
void ffInitBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBoardModuleInfo = {
|
||||
.name = FF_BOARD_MODULE_NAME,
|
||||
.description = "Print motherboard name and other info",
|
||||
@@ -122,14 +132,3 @@ FFModuleBaseInfo ffBoardModuleInfo = {
|
||||
{"Board serial number", "serial"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBoardModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BOARD_MODULE_NAME "Board"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFBoardOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBoardOptions;
|
||||
|
||||
static_assert(sizeof(FFBoardOptions) <= FF_OPTION_MAX_SIZE, "FFBoardOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -97,6 +97,16 @@ exit:
|
||||
ffStrbufDestroy(&bootmgr.firmware);
|
||||
}
|
||||
|
||||
void ffInitBootmgrOptions(FFBootmgrOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBootmgrOptions(FFBootmgrOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBootmgrModuleInfo = {
|
||||
.name = FF_BOOTMGR_MODULE_NAME,
|
||||
.description = "Print information of 2nd-stage bootloader (name, firmware, etc)",
|
||||
@@ -114,14 +124,3 @@ FFModuleBaseInfo ffBootmgrModuleInfo = {
|
||||
{"Boot order", "order"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBootmgrOptions(FFBootmgrOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBootmgrModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBootmgrOptions(FFBootmgrOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BOOTMGR_MODULE_NAME "Bootmgr"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFBootmgrOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBootmgrOptions;
|
||||
|
||||
static_assert(sizeof(FFBootmgrOptions) <= FF_OPTION_MAX_SIZE, "FFBootmgrOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -21,6 +21,14 @@ void ffParseBreakJsonObject(FF_MAYBE_UNUSED FFBreakOptions* options, FF_MAYBE_UN
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
}
|
||||
|
||||
void ffDestroyBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBreakModuleInfo = {
|
||||
.name = FF_BREAK_MODULE_NAME,
|
||||
.description = "Print a empty line",
|
||||
@@ -29,12 +37,3 @@ FFModuleBaseInfo ffBreakModuleInfo = {
|
||||
.parseJsonObject = (void*) ffParseBreakJsonObject,
|
||||
.printModule = (void*) ffPrintBreak,
|
||||
};
|
||||
|
||||
void ffInitBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBreakModuleInfo;
|
||||
}
|
||||
|
||||
void ffDestroyBreakOptions(FF_MAYBE_UNUSED FFBreakOptions* options)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BREAK_MODULE_NAME "Break"
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFBreakOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
} FFBreakOptions;
|
||||
|
||||
static_assert(sizeof(FFBreakOptions) <= FF_OPTION_MAX_SIZE, "FFBreakOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -187,6 +187,20 @@ void ffGenerateBrightnessJsonResult(FF_MAYBE_UNUSED FFBrightnessOptions* options
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->ddcciSleep = 10;
|
||||
options->percent = (FFPercentageModuleConfig) { 100, 100, 0 };
|
||||
options->compact = false;
|
||||
}
|
||||
|
||||
void ffDestroyBrightnessOptions(FFBrightnessOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBrightnessModuleInfo = {
|
||||
.name = FF_BRIGHTNESS_MODULE_NAME,
|
||||
.description = "Print current brightness level of your monitors",
|
||||
@@ -206,18 +220,3 @@ FFModuleBaseInfo ffBrightnessModuleInfo = {
|
||||
{"Is built-in screen", "is-builtin"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBrightnessOptions(FFBrightnessOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBrightnessModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->ddcciSleep = 10;
|
||||
options->percent = (FFPercentageModuleConfig) { 100, 100, 0 };
|
||||
options->compact = false;
|
||||
}
|
||||
|
||||
void ffDestroyBrightnessOptions(FFBrightnessOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BRIGHTNESS_MODULE_NAME "Brightness"
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef struct FFBrightnessOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
uint32_t ddcciSleep; // ms
|
||||
FFPercentageModuleConfig percent;
|
||||
bool compact;
|
||||
} FFBrightnessOptions;
|
||||
|
||||
static_assert(sizeof(FFBrightnessOptions) <= FF_OPTION_MAX_SIZE, "FFBrightnessOptions size exceeds maximum allowed size");
|
||||
|
||||
+11
-12
@@ -200,6 +200,17 @@ void ffGenerateBtrfsJsonResult(FF_MAYBE_UNUSED FFBtrfsOptions* options, yyjson_m
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitBtrfsOptions(FFBtrfsOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyBtrfsOptions(FFBtrfsOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffBtrfsModuleInfo = {
|
||||
.name = FF_BTRFS_MODULE_NAME,
|
||||
.description = "Print Linux BTRFS volumes",
|
||||
@@ -225,15 +236,3 @@ FFModuleBaseInfo ffBtrfsModuleInfo = {
|
||||
{"Sector size", "sector-size"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitBtrfsOptions(FFBtrfsOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffBtrfsModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyBtrfsOptions(FFBtrfsOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_BTRFS_MODULE_NAME "Btrfs"
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef struct FFBtrfsOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFBtrfsOptions;
|
||||
|
||||
static_assert(sizeof(FFBtrfsOptions) <= FF_OPTION_MAX_SIZE, "FFBtrfsOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -120,6 +120,16 @@ void ffGenerateCameraJsonResult(FF_MAYBE_UNUSED FFCameraOptions* options, yyjson
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitCameraOptions(FFCameraOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyCameraOptions(FFCameraOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCameraModuleInfo = {
|
||||
.name = FF_CAMERA_MODULE_NAME,
|
||||
.description = "Print available cameras",
|
||||
@@ -138,14 +148,3 @@ FFModuleBaseInfo ffCameraModuleInfo = {
|
||||
{"Height (in px)", "height"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitCameraOptions(FFCameraOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCameraModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyCameraOptions(FFCameraOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CAMERA_MODULE_NAME "Camera"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFCameraOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFCameraOptions;
|
||||
|
||||
static_assert(sizeof(FFCameraOptions) <= FF_OPTION_MAX_SIZE, "FFCameraOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -107,6 +107,16 @@ exit:
|
||||
ffStrbufDestroy(&result.serial);
|
||||
}
|
||||
|
||||
void ffInitChassisOptions(FFChassisOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyChassisOptions(FFChassisOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffChassisModuleInfo = {
|
||||
.name = FF_CHASSIS_MODULE_NAME,
|
||||
.description = "Print chassis type (desktop, laptop, etc)",
|
||||
@@ -123,14 +133,3 @@ FFModuleBaseInfo ffChassisModuleInfo = {
|
||||
{"Chassis serial number", "serial"},
|
||||
})),
|
||||
};
|
||||
|
||||
void ffInitChassisOptions(FFChassisOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffChassisModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyChassisOptions(FFChassisOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CHASSIS_MODULE_NAME "Chassis"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFChassisOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFChassisOptions;
|
||||
|
||||
static_assert(sizeof(FFChassisOptions) <= FF_OPTION_MAX_SIZE, "FFChassisOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -239,19 +239,8 @@ void ffGenerateColorsJsonConfig(FFColorsOptions* options, yyjson_mut_doc* doc, y
|
||||
}
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffColorsModuleInfo = {
|
||||
.name = FF_COLORS_MODULE_NAME,
|
||||
.description = "Print some colored blocks",
|
||||
.initOptions = (void*) ffInitColorsOptions,
|
||||
.destroyOptions = (void*) ffDestroyColorsOptions,
|
||||
.parseJsonObject = (void*) ffParseColorsJsonObject,
|
||||
.printModule = (void*) ffPrintColors,
|
||||
.generateJsonConfig = (void*) ffGenerateColorsJsonConfig,
|
||||
};
|
||||
|
||||
void ffInitColorsOptions(FFColorsOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffColorsModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||
options->symbol = FF_COLORS_SYMBOL_BACKGROUND;
|
||||
@@ -266,3 +255,13 @@ void ffDestroyColorsOptions(FF_MAYBE_UNUSED FFColorsOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffColorsModuleInfo = {
|
||||
.name = FF_COLORS_MODULE_NAME,
|
||||
.description = "Print some colored blocks",
|
||||
.initOptions = (void*) ffInitColorsOptions,
|
||||
.destroyOptions = (void*) ffDestroyColorsOptions,
|
||||
.parseJsonObject = (void*) ffParseColorsJsonObject,
|
||||
.printModule = (void*) ffPrintColors,
|
||||
.generateJsonConfig = (void*) ffGenerateColorsJsonConfig,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_COLORS_MODULE_NAME "Colors"
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum __attribute__((__packed__)) FFColorsSymbol
|
||||
@@ -23,10 +21,11 @@ typedef struct FFBlockConfig
|
||||
|
||||
typedef struct FFColorsOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFColorsSymbol symbol;
|
||||
uint32_t paddingLeft;
|
||||
FFBlockConfig block;
|
||||
} FFColorsOptions;
|
||||
|
||||
static_assert(sizeof(FFColorsOptions) <= FF_OPTION_MAX_SIZE, "FFColorsOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -120,23 +120,8 @@ void ffGenerateCommandJsonResult(FF_MAYBE_UNUSED FFCommandOptions* options, yyjs
|
||||
yyjson_mut_obj_add_strbuf(doc, module, "result", &result);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCommandModuleInfo = {
|
||||
.name = FF_COMMAND_MODULE_NAME,
|
||||
.description = "Run custom shell scripts",
|
||||
.initOptions = (void*) ffInitCommandOptions,
|
||||
.destroyOptions = (void*) ffDestroyCommandOptions,
|
||||
.parseJsonObject = (void*) ffParseCommandJsonObject,
|
||||
.printModule = (void*) ffPrintCommand,
|
||||
.generateJsonResult = (void*) ffGenerateCommandJsonResult,
|
||||
.generateJsonConfig = (void*) ffGenerateCommandJsonConfig,
|
||||
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||
{"Command result", "result"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitCommandOptions(FFCommandOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCommandModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffStrbufInitStatic(&options->shell,
|
||||
@@ -163,3 +148,17 @@ void ffDestroyCommandOptions(FFCommandOptions* options)
|
||||
ffStrbufDestroy(&options->param);
|
||||
ffStrbufDestroy(&options->text);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCommandModuleInfo = {
|
||||
.name = FF_COMMAND_MODULE_NAME,
|
||||
.description = "Run custom shell scripts",
|
||||
.initOptions = (void*) ffInitCommandOptions,
|
||||
.destroyOptions = (void*) ffDestroyCommandOptions,
|
||||
.parseJsonObject = (void*) ffParseCommandJsonObject,
|
||||
.printModule = (void*) ffPrintCommand,
|
||||
.generateJsonResult = (void*) ffGenerateCommandJsonResult,
|
||||
.generateJsonConfig = (void*) ffGenerateCommandJsonConfig,
|
||||
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||
{"Command result", "result"},
|
||||
}))
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_COMMAND_MODULE_NAME "Command"
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFCommandOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFstrbuf shell;
|
||||
FFstrbuf param;
|
||||
FFstrbuf text;
|
||||
} FFCommandOptions;
|
||||
|
||||
static_assert(sizeof(FFCommandOptions) <= FF_OPTION_MAX_SIZE, "FFCommandOptions size exceeds maximum allowed size");
|
||||
|
||||
+13
-14
@@ -212,6 +212,19 @@ void ffGenerateCPUJsonResult(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
ffStrbufDestroy(&cpu.vendor);
|
||||
}
|
||||
|
||||
void ffInitCPUOptions(FFCPUOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->showPeCoreCount = false;
|
||||
}
|
||||
|
||||
void ffDestroyCPUOptions(FFCPUOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCPUModuleInfo = {
|
||||
.name = FF_CPU_MODULE_NAME,
|
||||
.description = "Print CPU name, frequency, etc",
|
||||
@@ -234,17 +247,3 @@ FFModuleBaseInfo ffCPUModuleInfo = {
|
||||
{"Processor package count", "packages"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitCPUOptions(FFCPUOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCPUModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->showPeCoreCount = false;
|
||||
}
|
||||
|
||||
void ffDestroyCPUOptions(FFCPUOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CPU_MODULE_NAME "CPU"
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFCPUOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool temp;
|
||||
FFColorRangeConfig tempConfig;
|
||||
bool showPeCoreCount;
|
||||
} FFCPUOptions;
|
||||
|
||||
static_assert(sizeof(FFCPUOptions) <= FF_OPTION_MAX_SIZE, "FFCPUOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -208,6 +208,18 @@ exit:
|
||||
ffListDestroy(&result.caches[3]);
|
||||
}
|
||||
|
||||
void ffInitCPUCacheOptions(FFCPUCacheOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->compact = false;
|
||||
}
|
||||
|
||||
void ffDestroyCPUCacheOptions(FFCPUCacheOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCPUCacheModuleInfo = {
|
||||
.name = FF_CPUCACHE_MODULE_NAME,
|
||||
.description = "Print CPU cache sizes",
|
||||
@@ -222,16 +234,3 @@ FFModuleBaseInfo ffCPUCacheModuleInfo = {
|
||||
{"Sum result", "sum"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitCPUCacheOptions(FFCPUCacheOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCPUCacheModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->compact = false;
|
||||
}
|
||||
|
||||
void ffDestroyCPUCacheOptions(FFCPUCacheOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CPUCACHE_MODULE_NAME "CPUCache"
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFCPUCacheOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool compact;
|
||||
} FFCPUCacheOptions;
|
||||
|
||||
static_assert(sizeof(FFCPUCacheOptions) <= FF_OPTION_MAX_SIZE, "FFCPUCacheOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -174,6 +174,19 @@ void ffGenerateCPUUsageJsonResult(FFCPUUsageOptions* options, yyjson_mut_doc* do
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->separate = false;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
options->waitTime = 200;
|
||||
}
|
||||
|
||||
void ffDestroyCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCPUUsageModuleInfo = {
|
||||
.name = FF_CPUUSAGE_MODULE_NAME,
|
||||
.description = "Print CPU usage. Costs some time to collect data",
|
||||
@@ -194,17 +207,3 @@ FFModuleBaseInfo ffCPUUsageModuleInfo = {
|
||||
{"CPU usage (percentage bar, minimum)", "min-bar"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCPUUsageModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->separate = false;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
options->waitTime = 200;
|
||||
}
|
||||
|
||||
void ffDestroyCPUUsageOptions(FFCPUUsageOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CPUUSAGE_MODULE_NAME "CPUUsage"
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
typedef struct FFCPUUsageOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool separate;
|
||||
FFPercentageModuleConfig percent;
|
||||
uint32_t waitTime; // in ms
|
||||
} FFCPUUsageOptions;
|
||||
|
||||
static_assert(sizeof(FFCPUUsageOptions) <= FF_OPTION_MAX_SIZE, "FFCPUUsageOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -94,6 +94,16 @@ void ffGenerateCursorJsonResult(FF_MAYBE_UNUSED FFCursorOptions* options, yyjson
|
||||
ffStrbufDestroy(&result.size);
|
||||
}
|
||||
|
||||
void ffInitCursorOptions(FFCursorOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyCursorOptions(FFCursorOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCursorModuleInfo = {
|
||||
.name = FF_CURSOR_MODULE_NAME,
|
||||
.description = "Print cursor style name",
|
||||
@@ -108,14 +118,3 @@ FFModuleBaseInfo ffCursorModuleInfo = {
|
||||
{"Cursor size", "size"},
|
||||
})),
|
||||
};
|
||||
|
||||
void ffInitCursorOptions(FFCursorOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCursorModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyCursorOptions(FFCursorOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CURSOR_MODULE_NAME "Cursor"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFCursorOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFCursorOptions;
|
||||
|
||||
static_assert(sizeof(FFCursorOptions) <= FF_OPTION_MAX_SIZE, "FFCursorOptions size exceeds maximum allowed size");
|
||||
|
||||
+11
-12
@@ -30,6 +30,17 @@ void ffParseCustomJsonObject(FFCustomOptions* options, yyjson_val* module)
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitCustomOptions(FFCustomOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||
}
|
||||
|
||||
void ffDestroyCustomOptions(FFCustomOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffCustomModuleInfo = {
|
||||
.name = FF_CUSTOM_MODULE_NAME,
|
||||
.description = "Print a custom string, with or without key",
|
||||
@@ -39,15 +50,3 @@ FFModuleBaseInfo ffCustomModuleInfo = {
|
||||
.printModule = (void*) ffPrintCustom,
|
||||
.generateJsonConfig = (void*) ffGenerateCustomJsonConfig,
|
||||
};
|
||||
|
||||
void ffInitCustomOptions(FFCustomOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffCustomModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
ffStrbufSetStatic(&options->moduleArgs.key, " ");
|
||||
}
|
||||
|
||||
void ffDestroyCustomOptions(FFCustomOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_CUSTOM_MODULE_NAME "Custom"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFCustomOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFCustomOptions;
|
||||
|
||||
static_assert(sizeof(FFCustomOptions) <= FF_OPTION_MAX_SIZE, "FFCustomOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -143,6 +143,16 @@ void ffGenerateDateTimeJsonResult(FF_MAYBE_UNUSED FFDateTimeOptions* options, yy
|
||||
yyjson_mut_obj_add_strcpy(doc, module, "result", ffTimeToFullStr(ffTimeGetNow()));
|
||||
}
|
||||
|
||||
void ffInitDateTimeOptions(FFDateTimeOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyDateTimeOptions(FFDateTimeOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffDateTimeModuleInfo = {
|
||||
.name = FF_DATETIME_MODULE_NAME,
|
||||
.description = "Print current date and time",
|
||||
@@ -178,14 +188,3 @@ FFModuleBaseInfo ffDateTimeModuleInfo = {
|
||||
{"Day in month with leading zero", "day-pretty"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitDateTimeOptions(FFDateTimeOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffDateTimeModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyDateTimeOptions(FFDateTimeOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_DATETIME_MODULE_NAME "DateTime"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFDateTimeOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFDateTimeOptions;
|
||||
|
||||
static_assert(sizeof(FFDateTimeOptions) <= FF_OPTION_MAX_SIZE, "FFDateTimeOptions size exceeds maximum allowed size");
|
||||
|
||||
+12
-13
@@ -91,6 +91,18 @@ void ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "version", &version);
|
||||
}
|
||||
|
||||
void ffInitDEOptions(FFDEOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->slowVersionDetection = false;
|
||||
}
|
||||
|
||||
void ffDestroyDEOptions(FFDEOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffDEModuleInfo = {
|
||||
.name = FF_DE_MODULE_NAME,
|
||||
.description = "Print desktop environment name",
|
||||
@@ -106,16 +118,3 @@ FFModuleBaseInfo ffDEModuleInfo = {
|
||||
{"DE version", "version"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitDEOptions(FFDEOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffDEModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->slowVersionDetection = false;
|
||||
}
|
||||
|
||||
void ffDestroyDEOptions(FFDEOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_DE_MODULE_NAME "DE"
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFDEOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
bool slowVersionDetection;
|
||||
} FFDEOptions;
|
||||
|
||||
static_assert(sizeof(FFDEOptions) <= FF_OPTION_MAX_SIZE, "FFDEOptions size exceeds maximum allowed size");
|
||||
|
||||
+24
-25
@@ -412,6 +412,30 @@ void ffGenerateDiskJsonResult(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffStrbufInit(&options->folders);
|
||||
#if _WIN32 || __APPLE__ || __ANDROID__
|
||||
ffStrbufInit(&options->hideFolders);
|
||||
#else
|
||||
ffStrbufInitStatic(&options->hideFolders, "/efi:/boot:/boot/efi:/boot/firmware");
|
||||
#endif
|
||||
ffStrbufInit(&options->hideFS);
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
ffStrbufDestroy(&options->folders);
|
||||
ffStrbufDestroy(&options->hideFolders);
|
||||
ffStrbufDestroy(&options->hideFS);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffDiskModuleInfo = {
|
||||
.name = FF_DISK_MODULE_NAME,
|
||||
.description = "Print partitions, space usage, file system, etc",
|
||||
@@ -448,28 +472,3 @@ FFModuleBaseInfo ffDiskModuleInfo = {
|
||||
{"Years fraction after creation", "years-fraction"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffDiskModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffStrbufInit(&options->folders);
|
||||
#if _WIN32 || __APPLE__ || __ANDROID__
|
||||
ffStrbufInit(&options->hideFolders);
|
||||
#else
|
||||
ffStrbufInitStatic(&options->hideFolders, "/efi:/boot:/boot/efi:/boot/firmware");
|
||||
#endif
|
||||
ffStrbufInit(&options->hideFS);
|
||||
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
options->calcType = FF_DISK_CALC_TYPE_FREE;
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyDiskOptions(FFDiskOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
ffStrbufDestroy(&options->folders);
|
||||
ffStrbufDestroy(&options->hideFolders);
|
||||
ffStrbufDestroy(&options->hideFS);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_DISK_MODULE_NAME "Disk"
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
@@ -25,7 +23,6 @@ typedef enum __attribute__((__packed__)) FFDiskCalcType
|
||||
|
||||
typedef struct FFDiskOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFstrbuf folders;
|
||||
@@ -35,3 +32,5 @@ typedef struct FFDiskOptions
|
||||
FFDiskCalcType calcType;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFDiskOptions;
|
||||
|
||||
static_assert(sizeof(FFDiskOptions) <= FF_OPTION_MAX_SIZE, "FFDiskOptions size exceeds maximum allowed size");
|
||||
|
||||
+15
-16
@@ -170,6 +170,21 @@ void ffGenerateDiskIOJsonResult(FFDiskIOOptions* options, yyjson_mut_doc* doc, y
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitDiskIOOptions(FFDiskIOOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffStrbufInit(&options->namePrefix);
|
||||
options->detectTotal = false;
|
||||
options->waitTime = 1000;
|
||||
}
|
||||
|
||||
void ffDestroyDiskIOOptions(FFDiskIOOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
ffStrbufDestroy(&options->namePrefix);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffDiskIOModuleInfo = {
|
||||
.name = FF_DISKIO_MODULE_NAME,
|
||||
.description = "Print physical disk I/O throughput",
|
||||
@@ -190,19 +205,3 @@ FFModuleBaseInfo ffDiskIOModuleInfo = {
|
||||
{"Number of writes", "write-count"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitDiskIOOptions(FFDiskIOOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffDiskIOModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
ffStrbufInit(&options->namePrefix);
|
||||
options->detectTotal = false;
|
||||
options->waitTime = 1000;
|
||||
}
|
||||
|
||||
void ffDestroyDiskIOOptions(FFDiskIOOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
ffStrbufDestroy(&options->namePrefix);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_DISKIO_MODULE_NAME "DiskIO"
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFDiskIOOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFstrbuf namePrefix;
|
||||
uint32_t waitTime;
|
||||
bool detectTotal;
|
||||
} FFDiskIOOptions;
|
||||
|
||||
static_assert(sizeof(FFDiskIOOptions) <= FF_OPTION_MAX_SIZE, "FFDiskIOOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -402,6 +402,18 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitDisplayOptions(FFDisplayOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||
options->preciseRefreshRate = false;
|
||||
}
|
||||
|
||||
void ffDestroyDisplayOptions(FFDisplayOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffDisplayModuleInfo = {
|
||||
.name = FF_DISPLAY_MODULE_NAME,
|
||||
.description = "Print resolutions, refresh rates, etc",
|
||||
@@ -438,16 +450,3 @@ FFModuleBaseInfo ffDisplayModuleInfo = {
|
||||
{"Screen preferred refresh rate (in Hz)", "preferred-refresh-rate"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitDisplayOptions(FFDisplayOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffDisplayModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->compactType = FF_DISPLAY_COMPACT_TYPE_NONE;
|
||||
options->preciseRefreshRate = false;
|
||||
}
|
||||
|
||||
void ffDestroyDisplayOptions(FFDisplayOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_DISPLAY_MODULE_NAME "Display"
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum __attribute__((__packed__)) FFDisplayCompactType
|
||||
@@ -22,10 +20,11 @@ typedef enum __attribute__((__packed__)) FFDisplayOrder
|
||||
|
||||
typedef struct FFDisplayOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFDisplayCompactType compactType;
|
||||
bool preciseRefreshRate;
|
||||
FFDisplayOrder order;
|
||||
} FFDisplayOptions;
|
||||
|
||||
static_assert(sizeof(FFDisplayOptions) <= FF_OPTION_MAX_SIZE, "FFDisplayOptions size exceeds maximum allowed size");
|
||||
|
||||
+12
-13
@@ -139,6 +139,18 @@ exit:
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitDNSOptions(FFDNSOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->showType = FF_DNS_TYPE_BOTH;
|
||||
}
|
||||
|
||||
void ffDestroyDNSOptions(FFDNSOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffDNSModuleInfo = {
|
||||
.name = FF_DNS_MODULE_NAME,
|
||||
.description = "Print configured DNS servers",
|
||||
@@ -152,16 +164,3 @@ FFModuleBaseInfo ffDNSModuleInfo = {
|
||||
{"DNS result", "result"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitDNSOptions(FFDNSOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffDNSModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->showType = FF_DNS_TYPE_BOTH;
|
||||
}
|
||||
|
||||
void ffDestroyDNSOptions(FFDNSOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_DNS_MODULE_NAME "DNS"
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef enum __attribute__((__packed__)) FFDNSShowType {
|
||||
@@ -13,8 +11,9 @@ typedef enum __attribute__((__packed__)) FFDNSShowType {
|
||||
|
||||
typedef struct FFDNSOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFDNSShowType showType;
|
||||
} FFDNSOptions;
|
||||
|
||||
static_assert(sizeof(FFDNSOptions) <= FF_OPTION_MAX_SIZE, "FFDNSOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -104,6 +104,16 @@ void ffGenerateEditorJsonResult(FF_MAYBE_UNUSED FFEditorOptions* options, yyjson
|
||||
ffStrbufDestroy(&result.version);
|
||||
}
|
||||
|
||||
void ffInitEditorOptions(FFEditorOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyEditorOptions(FFEditorOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffEditorModuleInfo = {
|
||||
.name = FF_EDITOR_MODULE_NAME,
|
||||
.description = "Print information of the default editor ($VISUAL or $EDITOR)",
|
||||
@@ -121,14 +131,3 @@ FFModuleBaseInfo ffEditorModuleInfo = {
|
||||
{"Version", "version"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitEditorOptions(FFEditorOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffEditorModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyEditorOptions(FFEditorOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_EDITOR_MODULE_NAME "Editor"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFEditorOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFEditorOptions;
|
||||
|
||||
static_assert(sizeof(FFEditorOptions) <= FF_OPTION_MAX_SIZE, "FFEditorOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -88,6 +88,16 @@ void ffGenerateFontJsonResult(FF_MAYBE_UNUSED FFFontOptions* options, yyjson_mut
|
||||
ffStrbufDestroy(&font.fonts[i]);
|
||||
}
|
||||
|
||||
void ffInitFontOptions(FFFontOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyFontOptions(FFFontOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffFontModuleInfo = {
|
||||
.name = FF_FONT_MODULE_NAME,
|
||||
.description = "Print system font names",
|
||||
@@ -105,14 +115,3 @@ FFModuleBaseInfo ffFontModuleInfo = {
|
||||
{"Combined fonts for display", "combined"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitFontOptions(FFFontOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffFontModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyFontOptions(FFFontOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_FONT_MODULE_NAME "Font"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFFontOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFFontOptions;
|
||||
|
||||
static_assert(sizeof(FFFontOptions) <= FF_OPTION_MAX_SIZE, "FFFontOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -130,6 +130,17 @@ void ffGenerateGamepadJsonResult(FF_MAYBE_UNUSED FFGamepadOptions* options, yyjs
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyGamepadOptions(FFGamepadOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffGamepadModuleInfo = {
|
||||
.name = FF_GAMEPAD_MODULE_NAME,
|
||||
.description = "List (connected) gamepads",
|
||||
@@ -146,15 +157,3 @@ FFModuleBaseInfo ffGamepadModuleInfo = {
|
||||
{"Battery percentage bar", "battery-percentage-bar"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitGamepadOptions(FFGamepadOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffGamepadModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 20, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyGamepadOptions(FFGamepadOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_GAMEPAD_MODULE_NAME "Gamepad"
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFGamepadOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFGamepadOptions;
|
||||
|
||||
static_assert(sizeof(FFGamepadOptions) <= FF_OPTION_MAX_SIZE, "FFGamepadOptions size exceeds maximum allowed size");
|
||||
|
||||
+23
-24
@@ -414,6 +414,29 @@ void ffGenerateGPUJsonResult(FFGPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitGPUOptions(FFGPUOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->driverSpecific = false;
|
||||
options->detectionMethod =
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
FF_GPU_DETECTION_METHOD_PCI
|
||||
#else
|
||||
FF_GPU_DETECTION_METHOD_AUTO
|
||||
#endif
|
||||
;
|
||||
options->temp = false;
|
||||
options->hideType = FF_GPU_TYPE_NONE;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffGPUModuleInfo = {
|
||||
.name = FF_GPU_MODULE_NAME,
|
||||
.description = "Print GPU names, graphic memory size, type, etc",
|
||||
@@ -446,27 +469,3 @@ FFModuleBaseInfo ffGPUModuleInfo = {
|
||||
{"Memory type (Windows only)", "memory-type"},
|
||||
})),
|
||||
};
|
||||
|
||||
void ffInitGPUOptions(FFGPUOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffGPUModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
|
||||
options->driverSpecific = false;
|
||||
options->detectionMethod =
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
FF_GPU_DETECTION_METHOD_PCI
|
||||
#else
|
||||
FF_GPU_DETECTION_METHOD_AUTO
|
||||
#endif
|
||||
;
|
||||
options->temp = false;
|
||||
options->hideType = FF_GPU_TYPE_NONE;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
|
||||
}
|
||||
|
||||
void ffDestroyGPUOptions(FFGPUOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_GPU_MODULE_NAME "GPU"
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
#include "common/percent.h"
|
||||
|
||||
@@ -24,7 +22,6 @@ typedef enum __attribute__((__packed__)) FFGPUDetectionMethod
|
||||
|
||||
typedef struct FFGPUOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
|
||||
FFGPUType hideType;
|
||||
@@ -35,3 +32,5 @@ typedef struct FFGPUOptions
|
||||
FFColorRangeConfig tempConfig;
|
||||
FFPercentageModuleConfig percent;
|
||||
} FFGPUOptions;
|
||||
|
||||
static_assert(sizeof(FFGPUOptions) <= FF_OPTION_MAX_SIZE, "FFGPUOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -131,6 +131,16 @@ exit:
|
||||
ffStrbufDestroy(&host.vendor);
|
||||
}
|
||||
|
||||
void ffInitHostOptions(FFHostOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyHostOptions(FFHostOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffHostModuleInfo = {
|
||||
.name = FF_HOST_MODULE_NAME,
|
||||
.description = "Print product name of your computer",
|
||||
@@ -150,14 +160,3 @@ FFModuleBaseInfo ffHostModuleInfo = {
|
||||
{"Product uuid", "uuid"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitHostOptions(FFHostOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffHostModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyHostOptions(FFHostOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_HOST_MODULE_NAME "Host"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFHostOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFHostOptions;
|
||||
|
||||
static_assert(sizeof(FFHostOptions) <= FF_OPTION_MAX_SIZE, "FFHostOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -86,6 +86,16 @@ void ffGenerateIconsJsonResult(FF_MAYBE_UNUSED FFIconsOptions* options, yyjson_m
|
||||
ffStrbufDestroy(&result.icons2);
|
||||
}
|
||||
|
||||
void ffInitIconsOptions(FFIconsOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyIconsOptions(FFIconsOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffIconsModuleInfo = {
|
||||
.name = FF_ICONS_MODULE_NAME,
|
||||
.description = "Print icon style name",
|
||||
@@ -100,14 +110,3 @@ FFModuleBaseInfo ffIconsModuleInfo = {
|
||||
{"Icons part 2", "icons2"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitIconsOptions(FFIconsOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffIconsModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyIconsOptions(FFIconsOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_ICONS_MODULE_NAME "Icons"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFIconsOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFIconsOptions;
|
||||
|
||||
static_assert(sizeof(FFIconsOptions) <= FF_OPTION_MAX_SIZE, "FFIconsOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -98,6 +98,16 @@ exit:
|
||||
ffStrbufDestroy(&result.version);
|
||||
}
|
||||
|
||||
void ffInitInitSystemOptions(FFInitSystemOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyInitSystemOptions(FFInitSystemOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffInitSystemModuleInfo = {
|
||||
.name = FF_INITSYSTEM_MODULE_NAME,
|
||||
.description = "Print init system (pid 1) name and version",
|
||||
@@ -114,14 +124,3 @@ FFModuleBaseInfo ffInitSystemModuleInfo = {
|
||||
{"Init system pid", "pid"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitInitSystemOptions(FFInitSystemOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffInitSystemModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyInitSystemOptions(FFInitSystemOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_INITSYSTEM_MODULE_NAME "InitSystem"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFInitSystemOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFInitSystemOptions;
|
||||
|
||||
static_assert(sizeof(FFInitSystemOptions) <= FF_OPTION_MAX_SIZE, "FFInitSystemOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -66,6 +66,16 @@ void ffGenerateKernelJsonResult(FF_MAYBE_UNUSED FFKernelOptions* options, yyjson
|
||||
yyjson_mut_obj_add_uint(doc, obj, "pageSize", info->pageSize);
|
||||
}
|
||||
|
||||
void ffInitKernelOptions(FFKernelOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyKernelOptions(FFKernelOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffKernelModuleInfo = {
|
||||
.name = FF_KERNEL_MODULE_NAME,
|
||||
.description = "Print system kernel version",
|
||||
@@ -84,14 +94,3 @@ FFModuleBaseInfo ffKernelModuleInfo = {
|
||||
{"Page size", "page-size"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitKernelOptions(FFKernelOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffKernelModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyKernelOptions(FFKernelOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_KERNEL_MODULE_NAME "Kernel"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFKernelOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFKernelOptions;
|
||||
|
||||
static_assert(sizeof(FFKernelOptions) <= FF_OPTION_MAX_SIZE, "FFKernelOptions size exceeds maximum allowed size");
|
||||
|
||||
@@ -96,6 +96,16 @@ void ffGenerateKeyboardJsonResult(FF_MAYBE_UNUSED FFKeyboardOptions* options, yy
|
||||
}
|
||||
}
|
||||
|
||||
void ffInitKeyboardOptions(FFKeyboardOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyKeyboardOptions(FFKeyboardOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffKeyboardModuleInfo = {
|
||||
.name = FF_KEYBOARD_MODULE_NAME,
|
||||
.description = "List (connected) keyboards",
|
||||
@@ -110,14 +120,3 @@ FFModuleBaseInfo ffKeyboardModuleInfo = {
|
||||
{"Serial number", "serial"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitKeyboardOptions(FFKeyboardOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffKeyboardModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyKeyboardOptions(FFKeyboardOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "option.h"
|
||||
|
||||
#define FF_KEYBOARD_MODULE_NAME "Keyboard"
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// This file will be included in "fastfetch.h", do NOT put unnecessary things here
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFKeyboardOptions
|
||||
{
|
||||
FFModuleBaseInfo moduleInfo;
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFKeyboardOptions;
|
||||
|
||||
static_assert(sizeof(FFKeyboardOptions) <= FF_OPTION_MAX_SIZE, "FFKeyboardOptions size exceeds maximum allowed size");
|
||||
|
||||
+10
-11
@@ -99,6 +99,16 @@ exit:
|
||||
ffStrbufDestroy(&result.version);
|
||||
}
|
||||
|
||||
void ffInitLMOptions(FFLMOptions* options)
|
||||
{
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyLMOptions(FFLMOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffLMModuleInfo = {
|
||||
.name = FF_LM_MODULE_NAME,
|
||||
.description = "Print login manager (desktop manager) name and version",
|
||||
@@ -114,14 +124,3 @@ FFModuleBaseInfo ffLMModuleInfo = {
|
||||
{"LM version", "version"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitLMOptions(FFLMOptions* options)
|
||||
{
|
||||
options->moduleInfo = ffLMModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyLMOptions(FFLMOptions* options)
|
||||
{
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user