diff --git a/CHANGELOG.md b/CHANGELOG.md index 34836c573d..45031341bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,28 @@ +# 2.48.1 + +Features: +* Add support for detecting Openbox WM version (WM, Linux) +* Improve reliability of child process spawning on Windows (Windows) +* Add a new option `--packages-combined`, which combines related package managers into single counts (#1851, Packages) + * For example: if you have both `flatpak-system` and `flatpak-user` packages installed, they will be combined into a single `flatpak` count with `--packages-combined` enabled. +* Add `modules[n].condition` to conditionally enable modules on different platforms + * Useful when sharing configuration files across platforms + * For example: +```jsonc +{ + "type": "custom", + "format": "This string will be printed on Intel macOS only", + "condition": { + "system": "macOS", // Can be an array, optional + "arch": "x86_64" // Can be an array, optional too + } +} +``` + +Bugfixes: +* Revert the change of `posix_spawn` in v2.48.0 for Android and OpenBSD (Android / OpenBSD) + * Fix completion for Android 7 (Required by Termux) + # 2.48.0 Features: diff --git a/CMakeLists.txt b/CMakeLists.txt index 376942f235..e008886a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.48.0 + VERSION 2.48.1 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" diff --git a/debian/changelog b/debian/changelog index 0072fed021..331be609b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +fastfetch (2.48.0) jammy; urgency=medium + + * Update to 2.48.0 + + -- Carter Li Thu, 17 Jul 2025 16:16:52 +0800 + fastfetch (2.47.0) jammy; urgency=medium * Update to 2.47.0 diff --git a/debian/files b/debian/files index c4e4b79089..9c35d4bb28 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -fastfetch_2.47.0_source.buildinfo universe/utils optional +fastfetch_2.48.0_source.buildinfo universe/utils optional diff --git a/doc/json_schema.json b/doc/json_schema.json index 75148a5deb..a6a8165d49 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -108,6 +108,128 @@ } ] }, + "systems": { + "type": "string", + "enum": [ + "Android", + "Linux", + "DragonFly", + "MidnightBSD", + "FreeBSD", + "macOS", + "Windows", + "SunOS", + "OpenBSD", + "NetBSD", + "Haiku" + ] + }, + "architectures": { + "type": "string", + "enum": [ + "x86_64", + "i386", + "ia64", + "aarch64", + "arm", + "mips", + "powerpc", + "riscv", + "s390x", + "loongarch", + "sparc", + "alpha", + "hppa", + "m68k" + ] + }, + "conditions": { + "description": "Only show the module if conditions are met", + "type": "object", + "additionalProperties": false, + "properties": { + "system": { + "description": "System name to match", + "type": "string", + "oneOf": [ + { + "$ref": "#/$defs/systems" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/systems" + }, + "description": "Array of system names to match" + }, + { + "type": "null", + "description": "Null to disable this condition" + } + ] + }, + "!system": { + "description": "System name to not match", + "type": "string", + "oneOf": [ + { + "$ref": "#/$defs/systems" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/systems" + }, + "description": "Array of system names to not match" + }, + { + "type": "null", + "description": "Null to disable this condition" + } + ] + }, + "arch": { + "description": "Architecture to match", + "type": "string", + "oneOf": [ + { + "$ref": "#/$defs/architectures" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/architectures" + }, + "description": "Array of architectures to match" + }, + { + "type": "null", + "description": "Null to disable this condition" + } + ] + }, + "!arch": { + "description": "Architecture to not match", + "type": "string", + "oneOf": [ + { + "$ref": "#/$defs/architectures" + }, + { + "type": "array", + "items": { + "$ref": "#/$defs/architectures" + }, + "description": "Array of architectures to not match" + }, + { + "type": "null", + "description": "Null to disable this condition" + } + ] + } + } + }, "batteryFormat": { @@ -1005,6 +1127,7 @@ "host", "icons", "initsystem", + "keyboard", "kernel", "lm", "loadavg", @@ -1013,6 +1136,7 @@ "media", "memory", "monitor", + "mouse", "netio", "opencl", "opengl", @@ -1067,6 +1191,9 @@ "type": { "const": "break", "description": "Print a empty line" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1107,6 +1234,9 @@ }, "format": { "$ref": "#/$defs/batteryFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1136,6 +1266,9 @@ }, "format": { "$ref": "#/$defs/biosFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1173,6 +1306,9 @@ }, "format": { "$ref": "#/$defs/bluetoothFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1202,6 +1338,9 @@ }, "format": { "$ref": "#/$defs/bluetoothradioFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1231,6 +1370,9 @@ }, "format": { "$ref": "#/$defs/boardFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1260,6 +1402,9 @@ }, "format": { "$ref": "#/$defs/bootmgrFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1304,6 +1449,9 @@ }, "format": { "$ref": "#/$defs/brightnessFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1336,6 +1484,9 @@ }, "format": { "$ref": "#/$defs/btrfsFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1365,6 +1516,9 @@ }, "format": { "$ref": "#/$defs/cameraFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1394,6 +1548,9 @@ }, "format": { "$ref": "#/$defs/chassisFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1431,6 +1588,9 @@ }, "format": { "$ref": "#/$defs/cpuFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1463,6 +1623,9 @@ }, "format": { "$ref": "#/$defs/cpucacheFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1506,6 +1669,9 @@ }, "format": { "$ref": "#/$defs/cpuusageFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1567,6 +1733,9 @@ }, "keyIcon": { "$ref": "#/$defs/keyIcon" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1608,6 +1777,9 @@ }, "format": { "$ref": "#/$defs/commandFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1640,6 +1812,9 @@ }, "format": { "$ref": "#/$defs/cursorFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1671,6 +1846,9 @@ "format": { "description": "Text to print", "type": "string" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1703,6 +1881,9 @@ }, "format": { "$ref": "#/$defs/datetimeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1757,6 +1938,9 @@ }, "format": { "$ref": "#/$defs/displayFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1831,6 +2015,9 @@ }, "format": { "$ref": "#/$defs/diskFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1875,6 +2062,9 @@ }, "format": { "$ref": "#/$defs/diskioFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1909,6 +2099,9 @@ }, "format": { "$ref": "#/$defs/deFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1947,6 +2140,9 @@ }, "format": { "$ref": "#/$defs/dnsFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -1979,6 +2175,9 @@ }, "format": { "$ref": "#/$defs/editorFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2011,6 +2210,9 @@ }, "format": { "$ref": "#/$defs/fontFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2043,6 +2245,9 @@ }, "format": { "$ref": "#/$defs/gamepadFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2102,6 +2307,9 @@ }, "format": { "$ref": "#/$defs/gpuFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2131,6 +2339,9 @@ }, "format": { "$ref": "#/$defs/hostFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2160,6 +2371,9 @@ }, "format": { "$ref": "#/$defs/iconsFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2189,6 +2403,9 @@ }, "format": { "$ref": "#/$defs/initsystemFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2218,6 +2435,38 @@ }, "format": { "$ref": "#/$defs/kernelFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" + } + } + }, + { + "title": "Keyboard", + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "const": "keyboard", + "description": "List (connected) keyboards" + }, + "key": { + "$ref": "#/$defs/key" + }, + "keyColor": { + "$ref": "#/$defs/keyColor" + }, + "keyIcon": { + "$ref": "#/$defs/keyIcon" + }, + "keyWidth": { + "$ref": "#/$defs/keyWidth" + }, + "format": { + "$ref": "#/$defs/memoryFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2247,6 +2496,9 @@ }, "format": { "$ref": "#/$defs/lmFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2335,6 +2587,9 @@ }, "format": { "$ref": "#/$defs/localipFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2379,6 +2634,9 @@ }, "format": { "$ref": "#/$defs/loadavgFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2408,6 +2666,9 @@ }, "format": { "$ref": "#/$defs/localeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2437,6 +2698,9 @@ }, "format": { "$ref": "#/$defs/mediaFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2469,6 +2733,38 @@ }, "format": { "$ref": "#/$defs/memoryFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" + } + } + }, + { + "title": "Mouse", + "type": "object", + "additionalProperties": false, + "properties": { + "type": { + "const": "mouse", + "description": "List connected mouses" + }, + "key": { + "$ref": "#/$defs/key" + }, + "keyColor": { + "$ref": "#/$defs/keyColor" + }, + "keyIcon": { + "$ref": "#/$defs/keyIcon" + }, + "keyWidth": { + "$ref": "#/$defs/keyWidth" + }, + "format": { + "$ref": "#/$defs/memoryFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2498,6 +2794,9 @@ }, "format": { "$ref": "#/$defs/monitorFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2547,6 +2846,9 @@ }, "format": { "$ref": "#/$defs/netioFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2576,6 +2878,9 @@ }, "format": { "$ref": "#/$defs/openclFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2614,6 +2919,9 @@ }, "format": { "$ref": "#/$defs/openglFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2643,6 +2951,9 @@ }, "format": { "$ref": "#/$defs/osFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2696,6 +3007,11 @@ }, "default": ["winget"] }, + "combined": { + "description": "Whether to combine related package managers into single counts (e.g., nix-system + nix-user = nix)", + "type": "boolean", + "default": false + }, "key": { "$ref": "#/$defs/key" }, @@ -2713,6 +3029,9 @@ }, "format": { "$ref": "#/$defs/packagesFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2749,6 +3068,9 @@ }, "format": { "$ref": "#/$defs/physicaldiskFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2778,6 +3100,9 @@ }, "format": { "$ref": "#/$defs/physicalmemoryFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2807,6 +3132,9 @@ }, "format": { "$ref": "#/$defs/playerFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2836,6 +3164,9 @@ }, "format": { "$ref": "#/$defs/poweradapterFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2865,6 +3196,9 @@ }, "format": { "$ref": "#/$defs/processesFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2911,6 +3245,9 @@ }, "format": { "$ref": "#/$defs/publicipFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2937,6 +3274,9 @@ "type": "integer", "minimum": 0, "default": 0 + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -2966,6 +3306,9 @@ }, "format": { "$ref": "#/$defs/shellFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3008,6 +3351,9 @@ }, "format": { "$ref": "#/$defs/soundFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3045,6 +3391,9 @@ }, "format": { "$ref": "#/$defs/swapFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3074,6 +3423,9 @@ }, "format": { "$ref": "#/$defs/terminalFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3103,6 +3455,9 @@ }, "format": { "$ref": "#/$defs/terminalfontFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3132,6 +3487,9 @@ }, "format": { "$ref": "#/$defs/terminalsizeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3161,6 +3519,9 @@ }, "format": { "$ref": "#/$defs/terminalthemeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3190,6 +3551,9 @@ }, "format": { "$ref": "#/$defs/themeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3243,6 +3607,9 @@ }, "format": { "$ref": "#/$defs/titleFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3272,6 +3639,9 @@ }, "format": { "$ref": "#/$defs/tpmFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3311,6 +3681,9 @@ }, "format": { "$ref": "#/$defs/usersFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3340,6 +3713,9 @@ }, "format": { "$ref": "#/$defs/uptimeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3369,6 +3745,9 @@ }, "format": { "$ref": "#/$defs/versionFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3398,6 +3777,9 @@ }, "format": { "$ref": "#/$defs/vulkanFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3427,6 +3809,9 @@ }, "format": { "$ref": "#/$defs/wallpaperFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3471,6 +3856,9 @@ }, "format": { "$ref": "#/$defs/weatherFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3500,6 +3888,9 @@ }, "format": { "$ref": "#/$defs/wifiFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3534,6 +3925,9 @@ }, "format": { "$ref": "#/$defs/wmFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3563,6 +3957,9 @@ }, "format": { "$ref": "#/$defs/wmthemeFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } }, @@ -3595,6 +3992,9 @@ }, "format": { "$ref": "#/$defs/zpoolFormat" + }, + "condition": { + "$ref": "#/$defs/conditions" } } } diff --git a/presets/examples/25.jsonc b/presets/examples/25.jsonc index 527b0db6dc..85f4835f75 100644 --- a/presets/examples/25.jsonc +++ b/presets/examples/25.jsonc @@ -217,10 +217,23 @@ "key": "│{#magenta}│ {icon} Login │{$4}│{#keys}│{$2}" }, { + "condition": { + "!system": "macOS" + }, "type": "disk", "keyIcon": "", "key": "│{#magenta}│ {icon} OS Age │{$4}│{#keys}│{$2}", - "folders": "/", // On macOS, "/System/Volumes/VM" works for me + "folders": "/", + "format": "{create-time:10} [{days} days]" + }, + { + "condition": { + "system": "macOS" + }, + "type": "disk", + "keyIcon": "", + "key": "│{#magenta}│ {icon} OS Age │{$4}│{#keys}│{$2}", + "folders": "/System/Volumes/VM", "format": "{create-time:10} [{days} days]" }, { diff --git a/presets/neofetch.jsonc b/presets/neofetch.jsonc index 47330eb2bf..66f9b9de69 100644 --- a/presets/neofetch.jsonc +++ b/presets/neofetch.jsonc @@ -16,7 +16,10 @@ "format": "{release}" }, "uptime", - "packages", + { + "type": "packages", + "combined": true + }, "shell", { "type": "display", diff --git a/src/common/io/io.h b/src/common/io/io.h index 2bb6e6e23b..4eabaed04d 100644 --- a/src/common/io/io.h +++ b/src/common/io/io.h @@ -222,6 +222,8 @@ static inline bool ffSearchUserConfigFile(const FFlist* configDirs, const char* return false; } +FFNativeFD ffGetNullFD(void); + #ifdef _WIN32 // Only O_RDONLY is supported HANDLE openat(HANDLE dfd, const char* fileName, bool directory); diff --git a/src/common/io/io_unix.c b/src/common/io/io_unix.c index 8e354cd792..90560f3f64 100644 --- a/src/common/io/io_unix.c +++ b/src/common/io/io_unix.c @@ -358,3 +358,12 @@ void ffListFilesRecursively(const char* path, bool pretty) ffStrbufEnsureEndsWithC(&folder, '/'); listFilesRecursively(folder.length, &folder, 0, NULL, pretty); } + +FFNativeFD ffGetNullFD(void) +{ + static FFNativeFD hNullFile = -1; + if (hNullFile != -1) + return hNullFile; + hNullFile = open("/dev/null", O_WRONLY | O_CLOEXEC); + return hNullFile; +} diff --git a/src/common/io/io_windows.c b/src/common/io/io_windows.c index fa3057e76c..419a299299 100644 --- a/src/common/io/io_windows.c +++ b/src/common/io/io_windows.c @@ -175,7 +175,7 @@ bool ffSuppressIO(bool suppress) static bool init = false; static HANDLE hOrigOut = INVALID_HANDLE_VALUE; static HANDLE hOrigErr = INVALID_HANDLE_VALUE; - static HANDLE hNullFile = INVALID_HANDLE_VALUE; + HANDLE hNullFile = ffGetNullFD(); static int fOrigOut = -1; static int fOrigErr = -1; static int fNullFile = -1; @@ -187,7 +187,6 @@ bool ffSuppressIO(bool suppress) hOrigOut = GetStdHandle(STD_OUTPUT_HANDLE); hOrigErr = GetStdHandle(STD_ERROR_HANDLE); - hNullFile = CreateFileW(L"NUL", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, NULL); fOrigOut = _dup(STDOUT_FILENO); fOrigErr = _dup(STDERR_FILENO); fNullFile = _open_osfhandle((intptr_t) hNullFile, 0); @@ -352,3 +351,23 @@ const char* ffGetTerminalResponse(const char* request, int nParams, const char* return NULL; } + +FFNativeFD ffGetNullFD(void) +{ + static FFNativeFD hNullFile = INVALID_HANDLE_VALUE; + if (hNullFile != INVALID_HANDLE_VALUE) + return hNullFile; + hNullFile = CreateFileW( + L"NUL", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + 0, + &(SECURITY_ATTRIBUTES){ + .nLength = sizeof(SECURITY_ATTRIBUTES), + .lpSecurityDescriptor = NULL, + .bInheritHandle = TRUE, + }); + return hNullFile; +} diff --git a/src/common/jsonconfig.c b/src/common/jsonconfig.c index 6170f31e52..4170d6c66b 100644 --- a/src/common/jsonconfig.c +++ b/src/common/jsonconfig.c @@ -4,6 +4,7 @@ #include "common/printing.h" #include "common/io/io.h" #include "common/time.h" +#include "detection/version/version.h" #include "modules/modules.h" #include "util/stringUtils.h" @@ -170,6 +171,25 @@ static void prepareModuleJsonObject(const char* type, yyjson_val* module) } } +static bool matchesJsonArray(const char* str, yyjson_val* val) +{ + assert(val); + + if (unsafe_yyjson_is_str(val)) + return ffStrEqualsIgnCase(str, unsafe_yyjson_get_str(val)); + + if (!unsafe_yyjson_is_arr(val)) return false; + + size_t idx, max; + yyjson_val* item; + yyjson_arr_foreach(val, idx, max, item) + { + if (yyjson_is_str(item) && ffStrEqualsIgnCase(str, unsafe_yyjson_get_str(item))) + return true; + } + return false; +} + static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc) { yyjson_val* const root = yyjson_doc_get_root(instance.state.configDoc); @@ -197,6 +217,29 @@ static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc) module = NULL; else if (yyjson_is_obj(module)) { + yyjson_val* conditions = yyjson_obj_get(module, "condition"); + if (conditions) + { + if (!yyjson_is_obj(conditions)) + return "Property 'conditions' must be an object"; + + yyjson_val* system = yyjson_obj_get(conditions, "system"); + if (system && !matchesJsonArray(ffVersionResult.sysName, system)) + continue; + + system = yyjson_obj_get(conditions, "!system"); + if (system && matchesJsonArray(ffVersionResult.sysName, system)) + continue; + + yyjson_val* arch = yyjson_obj_get(conditions, "arch"); + if (arch && !matchesJsonArray(ffVersionResult.architecture, arch)) + continue; + + arch = yyjson_obj_get(conditions, "!arch"); + if (arch && matchesJsonArray(ffVersionResult.architecture, arch)) + continue; + } + type = yyjson_get_str(yyjson_obj_get(module, "type")); if (!type) return "module object must contain a \"type\" key ( case sensitive )"; if (yyjson_obj_size(module) == 1) // contains only Property type diff --git a/src/common/processing_linux.c b/src/common/processing_linux.c index 701ca48330..1fdfbae2a6 100644 --- a/src/common/processing_linux.c +++ b/src/common/processing_linux.c @@ -11,7 +11,10 @@ #include #include #include -#include + +#if !(__ANDROID__ || __OpenBSD__) + #include +#endif #if defined(__FreeBSD__) || defined(__APPLE__) #include @@ -63,11 +66,21 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use if(ffPipe2(pipes, O_CLOEXEC) == -1) return "pipe() failed"; + pid_t childPid = -1; + int nullFile = ffGetNullFD(); + + #if !(__ANDROID__ || __OpenBSD__) + + // NetBSD / Darwin: native syscall + // Linux (glibc): clone3-execve + // FreeBSD: vfork-execve + // illumos: vforkx-execve + // OpenBSD / Android (bionic): fork-execve + posix_spawn_file_actions_t file_actions; posix_spawn_file_actions_init(&file_actions); posix_spawn_file_actions_adddup2(&file_actions, pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO); - posix_spawn_file_actions_addopen(&file_actions, useStdErr ? STDOUT_FILENO : STDERR_FILENO, "/dev/null", O_WRONLY, 0); - pid_t childPid = -1; + posix_spawn_file_actions_adddup2(&file_actions, nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO); static char* oldLang = NULL; static int langIndex = -1; @@ -113,13 +126,38 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use posix_spawn_file_actions_destroy(&file_actions); - close(pipes[1]); if (ret != 0) { close(pipes[0]); + close(pipes[1]); return "posix_spawnp() failed"; } + #else + + // https://github.com/termux/termux-packages/issues/25369 + childPid = fork(); + if(childPid == -1) + { + close(pipes[0]); + close(pipes[1]); + return "fork() failed"; + } + + if(childPid == 0) + { + //Child + dup2(pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO); + dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO); + putenv("LANG=C.UTF-8"); + execvp(argv[0], argv); + _exit(127); + } + + #endif + + close(pipes[1]); + int FF_AUTO_CLOSE_FD childPipeFd = pipes[0]; char str[FF_PIPE_BUFSIZ]; diff --git a/src/common/processing_windows.c b/src/common/processing_windows.c index 3ec86583ee..c8f28d87e3 100644 --- a/src/common/processing_windows.c +++ b/src/common/processing_windows.c @@ -81,7 +81,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use if (hChildPipeWrite == INVALID_HANDLE_VALUE) return "CreateFileW(L\"\\\\.\\pipe\\FASTFETCH-$(PID)\") failed"; - PROCESS_INFORMATION piProcInfo = {0}; + PROCESS_INFORMATION piProcInfo = {}; BOOL success; @@ -91,9 +91,15 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use .dwFlags = STARTF_USESTDHANDLES, }; if (useStdErr) + { + siStartInfo.hStdOutput = ffGetNullFD(); siStartInfo.hStdError = hChildPipeWrite; + } else + { siStartInfo.hStdOutput = hChildPipeWrite; + siStartInfo.hStdError = ffGetNullFD(); + } FF_STRBUF_AUTO_DESTROY cmdline = ffStrbufCreate(); argvToCmdline(argv, &cmdline); diff --git a/src/data/help.json b/src/data/help.json index 0c7302bbf4..dbb27f5ace 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -990,6 +990,16 @@ "default": "winget" } }, + { + "long": "packages-combined", + "desc": "Whether to combine related package managers into single counts", + "remark": "e.g., nix-system + nix-user = nix", + "arg": { + "type": "bool", + "optional": true, + "default": false + } + }, { "long": "display-compact-type", "desc": "Specify whether all displays should be printed in one line", diff --git a/src/detection/version/version.c b/src/detection/version/version.c index 4b6c5e1c6c..f47ffcaa16 100644 --- a/src/detection/version/version.c +++ b/src/detection/version/version.c @@ -43,9 +43,9 @@ #elif defined(__FreeBSD__) #define FF_SYSNAME "FreeBSD" #elif defined(__APPLE__) - #define FF_SYSNAME "Darwin" + #define FF_SYSNAME "macOS" #elif defined(_WIN32) - #define FF_SYSNAME "WIN32" + #define FF_SYSNAME "Windows" #elif defined(__sun) #define FF_SYSNAME "SunOS" #elif defined(__OpenBSD__) diff --git a/src/detection/wm/wm_linux.c b/src/detection/wm/wm_linux.c index 1e8870f997..9b9956840b 100644 --- a/src/detection/wm/wm_linux.c +++ b/src/detection/wm/wm_linux.c @@ -176,7 +176,7 @@ static const char* getWslg(FFstrbuf* result) return NULL; } -static bool extractCtFvWmVersion(const char* line, FF_MAYBE_UNUSED uint32_t len, void *userdata) +static bool extractCommonWmVersion(const char* line, FF_MAYBE_UNUSED uint32_t len, void *userdata) { int count = 0; sscanf(line, "%*d.%*d.%*d%n", &count); @@ -192,7 +192,7 @@ static const char* getCtwm(FFstrbuf* result) const char* error = ffFindExecutableInPath("ctwm", &path); if (error) return "Failed to find ctwm executable path"; - ffBinaryExtractStrings(path.chars, extractCtFvWmVersion, result, (uint32_t) strlen("0.0.0")); + ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0")); if (result->length > 0) return NULL; if (ffProcessAppendStdOut(result, (char* const[]){ @@ -215,7 +215,7 @@ static const char* getFvwm(FFstrbuf* result) const char* error = ffFindExecutableInPath("fvwm", &path); if (error) return "Failed to find fvwm executable path"; - ffBinaryExtractStrings(path.chars, extractCtFvWmVersion, result, (uint32_t) strlen("0.0.0")); + ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0")); if (result->length > 0) return NULL; if (ffProcessAppendStdOut(result, (char* const[]){ @@ -232,6 +232,29 @@ static const char* getFvwm(FFstrbuf* result) return "Failed to run command `fvwm -version`"; } +static const char* getOpenbox(FFstrbuf* result) +{ + FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate(); + const char* error = ffFindExecutableInPath("openbox", &path); + if (error) return "Failed to find openbox executable path"; + + ffBinaryExtractStrings(path.chars, extractCommonWmVersion, result, (uint32_t) strlen("0.0.0")); + if (result->length > 0) return NULL; + + if (ffProcessAppendStdOut(result, (char* const[]){ + path.chars, + "--version", + NULL + }) == NULL) + { // Openbox 3.6.1\n... + ffStrbufSubstrBeforeFirstC(result, '\n'); + ffStrbufSubstrAfterLastC(result, ' '); + return NULL; + } + + return "Failed to run command `openbox --version`"; +} + const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE_UNUSED FFWMOptions* options) { if (!wmName) @@ -255,5 +278,8 @@ const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE if (ffStrbufEqualS(wmName, "fvwm")) return getFvwm(result); + if (ffStrbufEqualS(wmName, "Openbox")) + return getOpenbox(result); + return "Unsupported WM"; } diff --git a/src/modules/battery/battery.c b/src/modules/battery/battery.c index 02f5ab36f8..ba2327e341 100644 --- a/src/modules/battery/battery.c +++ b/src/modules/battery/battery.c @@ -186,7 +186,7 @@ void ffParseBatteryJsonObject(FFBatteryOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/bios/bios.c b/src/modules/bios/bios.c index a5363eebf9..b8a3b0cc3a 100644 --- a/src/modules/bios/bios.c +++ b/src/modules/bios/bios.c @@ -92,7 +92,7 @@ void ffParseBiosJsonObject(FFBiosOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/bluetooth/bluetooth.c b/src/modules/bluetooth/bluetooth.c index 7563b1d54a..b931785569 100644 --- a/src/modules/bluetooth/bluetooth.c +++ b/src/modules/bluetooth/bluetooth.c @@ -123,7 +123,7 @@ void ffParseBluetoothJsonObject(FFBluetoothOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/bluetoothradio/bluetoothradio.c b/src/modules/bluetoothradio/bluetoothradio.c index f5bd940c83..771296bded 100644 --- a/src/modules/bluetoothradio/bluetoothradio.c +++ b/src/modules/bluetoothradio/bluetoothradio.c @@ -122,7 +122,7 @@ void ffParseBluetoothRadioJsonObject(FFBluetoothRadioOptions* options, yyjson_va yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/board/board.c b/src/modules/board/board.c index f499446c82..a539aa9bfe 100644 --- a/src/modules/board/board.c +++ b/src/modules/board/board.c @@ -67,7 +67,7 @@ void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/bootmgr/bootmgr.c b/src/modules/bootmgr/bootmgr.c index 19162f15ab..601420bc53 100644 --- a/src/modules/bootmgr/bootmgr.c +++ b/src/modules/bootmgr/bootmgr.c @@ -67,7 +67,7 @@ void ffParseBootmgrJsonObject(FFBootmgrOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/brightness/brightness.c b/src/modules/brightness/brightness.c index 78caf587f4..bcbd81364d 100644 --- a/src/modules/brightness/brightness.c +++ b/src/modules/brightness/brightness.c @@ -144,7 +144,7 @@ void ffParseBrightnessJsonObject(FFBrightnessOptions* options, yyjson_val* modul yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/btrfs/btrfs.c b/src/modules/btrfs/btrfs.c index 6d6f1a7dc7..02ebf60324 100644 --- a/src/modules/btrfs/btrfs.c +++ b/src/modules/btrfs/btrfs.c @@ -149,7 +149,7 @@ void ffParseBtrfsJsonObject(FFBtrfsOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/camera/camera.c b/src/modules/camera/camera.c index 26ef4b3ce4..48d450f497 100644 --- a/src/modules/camera/camera.c +++ b/src/modules/camera/camera.c @@ -84,7 +84,7 @@ void ffParseCameraJsonObject(FFCameraOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/chassis/chassis.c b/src/modules/chassis/chassis.c index 16805a52af..5d7ef92393 100644 --- a/src/modules/chassis/chassis.c +++ b/src/modules/chassis/chassis.c @@ -68,7 +68,7 @@ void ffParseChassisJsonObject(FFChassisOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/colors/colors.c b/src/modules/colors/colors.c index 63c69b9994..7d4367b391 100644 --- a/src/modules/colors/colors.c +++ b/src/modules/colors/colors.c @@ -181,7 +181,7 @@ void ffParseColorsJsonObject(FFColorsOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/command/command.c b/src/modules/command/command.c index 7f5a283659..a6d38ab159 100644 --- a/src/modules/command/command.c +++ b/src/modules/command/command.c @@ -78,7 +78,7 @@ void ffParseCommandJsonObject(FFCommandOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c index d6f63bc975..178574aa0b 100644 --- a/src/modules/cpu/cpu.c +++ b/src/modules/cpu/cpu.c @@ -142,7 +142,7 @@ void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/cpucache/cpucache.c b/src/modules/cpucache/cpucache.c index ee6e2d9f1f..2be8f4551f 100644 --- a/src/modules/cpucache/cpucache.c +++ b/src/modules/cpucache/cpucache.c @@ -154,7 +154,7 @@ void ffParseCPUCacheJsonObject(FFCPUCacheOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/cpuusage/cpuusage.c b/src/modules/cpuusage/cpuusage.c index 6124311c7f..6d15261eb1 100644 --- a/src/modules/cpuusage/cpuusage.c +++ b/src/modules/cpuusage/cpuusage.c @@ -148,7 +148,7 @@ void ffParseCPUUsageJsonObject(FFCPUUsageOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/cursor/cursor.c b/src/modules/cursor/cursor.c index 93372cdc8b..9652398b50 100644 --- a/src/modules/cursor/cursor.c +++ b/src/modules/cursor/cursor.c @@ -65,7 +65,7 @@ void ffParseCursorJsonObject(FFCursorOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/custom/custom.c b/src/modules/custom/custom.c index 73f98dce66..b0f3175746 100644 --- a/src/modules/custom/custom.c +++ b/src/modules/custom/custom.c @@ -34,7 +34,7 @@ void ffParseCustomJsonObject(FFCustomOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/datetime/datetime.c b/src/modules/datetime/datetime.c index a5b4b06ce7..06bca8d605 100644 --- a/src/modules/datetime/datetime.c +++ b/src/modules/datetime/datetime.c @@ -134,7 +134,7 @@ void ffParseDateTimeJsonObject(FFDateTimeOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/de/de.c b/src/modules/de/de.c index 36746fa9a4..341e03e2c0 100644 --- a/src/modules/de/de.c +++ b/src/modules/de/de.c @@ -65,7 +65,7 @@ void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/disk/disk.c b/src/modules/disk/disk.c index a2fe912f3b..b840124436 100644 --- a/src/modules/disk/disk.c +++ b/src/modules/disk/disk.c @@ -304,7 +304,7 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/diskio/diskio.c b/src/modules/diskio/diskio.c index c9bafe68d7..08e0ca84e4 100644 --- a/src/modules/diskio/diskio.c +++ b/src/modules/diskio/diskio.c @@ -130,7 +130,7 @@ void ffParseDiskIOJsonObject(FFDiskIOOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/display/display.c b/src/modules/display/display.c index a8fa7a728c..a55c15d83f 100644 --- a/src/modules/display/display.c +++ b/src/modules/display/display.c @@ -261,7 +261,7 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/dns/dns.c b/src/modules/dns/dns.c index 29c04af07c..fc330a2f36 100644 --- a/src/modules/dns/dns.c +++ b/src/modules/dns/dns.c @@ -85,7 +85,7 @@ void ffParseDNSJsonObject(FFDNSOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/editor/editor.c b/src/modules/editor/editor.c index 61ea18d7f4..11afc0940a 100644 --- a/src/modules/editor/editor.c +++ b/src/modules/editor/editor.c @@ -71,7 +71,7 @@ void ffParseEditorJsonObject(FFEditorOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/font/font.c b/src/modules/font/font.c index 242b685ee3..8efd244ca3 100644 --- a/src/modules/font/font.c +++ b/src/modules/font/font.c @@ -58,7 +58,7 @@ void ffParseFontJsonObject(FFFontOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/gamepad/gamepad.c b/src/modules/gamepad/gamepad.c index 50be377969..3bcc4f6f9a 100644 --- a/src/modules/gamepad/gamepad.c +++ b/src/modules/gamepad/gamepad.c @@ -97,7 +97,7 @@ void ffParseGamepadJsonObject(FFGamepadOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index f7f4c90bc1..7d917c83df 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -255,7 +255,7 @@ void ffParseGPUJsonObject(FFGPUOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/host/host.c b/src/modules/host/host.c index 170a1b440a..609521f77e 100644 --- a/src/modules/host/host.c +++ b/src/modules/host/host.c @@ -84,7 +84,7 @@ void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/icons/icons.c b/src/modules/icons/icons.c index bfc846a991..3c0dd98db2 100644 --- a/src/modules/icons/icons.c +++ b/src/modules/icons/icons.c @@ -60,7 +60,7 @@ void ffParseIconsJsonObject(FFIconsOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/initsystem/initsystem.c b/src/modules/initsystem/initsystem.c index 5821c7d54f..38b8ece011 100644 --- a/src/modules/initsystem/initsystem.c +++ b/src/modules/initsystem/initsystem.c @@ -65,7 +65,7 @@ void ffParseInitSystemJsonObject(FFInitSystemOptions* options, yyjson_val* modul yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/kernel/kernel.c b/src/modules/kernel/kernel.c index 75ca36758a..44c85668ba 100644 --- a/src/modules/kernel/kernel.c +++ b/src/modules/kernel/kernel.c @@ -48,7 +48,7 @@ void ffParseKernelJsonObject(FFKernelOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/keyboard/keyboard.c b/src/modules/keyboard/keyboard.c index bea387a622..e48e533dfb 100644 --- a/src/modules/keyboard/keyboard.c +++ b/src/modules/keyboard/keyboard.c @@ -65,7 +65,7 @@ void ffParseKeyboardJsonObject(FFKeyboardOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/lm/lm.c b/src/modules/lm/lm.c index ff5fb5f9c1..5dc29dd3b9 100644 --- a/src/modules/lm/lm.c +++ b/src/modules/lm/lm.c @@ -64,7 +64,7 @@ void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/loadavg/loadavg.c b/src/modules/loadavg/loadavg.c index f42d04e12f..2a02f935af 100644 --- a/src/modules/loadavg/loadavg.c +++ b/src/modules/loadavg/loadavg.c @@ -122,7 +122,7 @@ void ffParseLoadavgJsonObject(FFLoadavgOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/locale/locale.c b/src/modules/locale/locale.c index 1849343b3a..ba82b32350 100644 --- a/src/modules/locale/locale.c +++ b/src/modules/locale/locale.c @@ -45,7 +45,7 @@ void ffParseLocaleJsonObject(FFLocaleOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/localip/localip.c b/src/modules/localip/localip.c index e1a5d1b301..e143fcf3f7 100644 --- a/src/modules/localip/localip.c +++ b/src/modules/localip/localip.c @@ -295,7 +295,7 @@ void ffParseLocalIpJsonObject(FFLocalIpOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/media/media.c b/src/modules/media/media.c index 98e6aef45d..08e446e544 100644 --- a/src/modules/media/media.c +++ b/src/modules/media/media.c @@ -123,7 +123,7 @@ void ffParseMediaJsonObject(FFMediaOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/memory/memory.c b/src/modules/memory/memory.c index 845a28b188..0af03736d4 100644 --- a/src/modules/memory/memory.c +++ b/src/modules/memory/memory.c @@ -91,7 +91,7 @@ void ffParseMemoryJsonObject(FFMemoryOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/monitor/monitor.c b/src/modules/monitor/monitor.c index 1e0255dbe1..afaab6a27f 100644 --- a/src/modules/monitor/monitor.c +++ b/src/modules/monitor/monitor.c @@ -103,7 +103,7 @@ void ffParseMonitorJsonObject(FFMonitorOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/mouse/mouse.c b/src/modules/mouse/mouse.c index f2dbd9def3..58a7cfcf0b 100644 --- a/src/modules/mouse/mouse.c +++ b/src/modules/mouse/mouse.c @@ -65,7 +65,7 @@ void ffParseMouseJsonObject(FFMouseOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/netio/netio.c b/src/modules/netio/netio.c index 50281338ee..d49ca61f9e 100644 --- a/src/modules/netio/netio.c +++ b/src/modules/netio/netio.c @@ -144,7 +144,7 @@ void ffParseNetIOJsonObject(FFNetIOOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/opencl/opencl.c b/src/modules/opencl/opencl.c index bcf2deae66..dd32e9c4af 100644 --- a/src/modules/opencl/opencl.c +++ b/src/modules/opencl/opencl.c @@ -47,7 +47,7 @@ void ffParseOpenCLJsonObject(FFOpenCLOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/opengl/opengl.c b/src/modules/opengl/opengl.c index f6d5398953..4dcebcdbac 100644 --- a/src/modules/opengl/opengl.c +++ b/src/modules/opengl/opengl.c @@ -71,7 +71,7 @@ void ffParseOpenGLJsonObject(FFOpenGLOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/os/os.c b/src/modules/os/os.c index 9edde87492..566af94145 100644 --- a/src/modules/os/os.c +++ b/src/modules/os/os.c @@ -132,7 +132,7 @@ void ffParseOSJsonObject(FFOSOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/packages/option.h b/src/modules/packages/option.h index 37a93c151e..40e5b14137 100644 --- a/src/modules/packages/option.h +++ b/src/modules/packages/option.h @@ -49,4 +49,5 @@ typedef struct FFPackagesOptions FFModuleArgs moduleArgs; FFPackagesFlags disabled; + bool combined; } FFPackagesOptions; diff --git a/src/modules/packages/packages.c b/src/modules/packages/packages.c index 8754cfa7f5..190347d3ec 100644 --- a/src/modules/packages/packages.c +++ b/src/modules/packages/packages.c @@ -17,20 +17,37 @@ void ffPrintPackages(FFPackagesOptions* options) return; } + uint32_t nixAll = counts.nixDefault + counts.nixSystem + counts.nixUser; + uint32_t flatpakAll = counts.flatpakSystem + counts.flatpakUser; + uint32_t brewAll = counts.brew + counts.brewCask; + uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome; + uint32_t hpkgAll = counts.hpkgSystem + counts.hpkgUser; + uint32_t amAll = counts.amSystem + counts.amUser; + if(options->moduleArgs.outputFormat.length == 0) { ffPrintLogoAndKey(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); - #define FF_PRINT_PACKAGE_NAME(var, name) \ + #define FF_PRINT_PACKAGE_NAME(var, name) {\ if(counts.var > 0) \ { \ printf("%u (%s)", counts.var, (name)); \ if((all -= counts.var) > 0) \ fputs(", ", stdout); \ - }; + } \ + } #define FF_PRINT_PACKAGE(name) FF_PRINT_PACKAGE_NAME(name, #name) + #define FF_PRINT_PACKAGE_ALL(name) {\ + if(name ## All > 0) \ + { \ + printf("%u (%s)", name ## All, #name); \ + if((all -= name ## All) > 0) \ + fputs(", ", stdout); \ + } \ + } + uint32_t all = counts.all; if(counts.pacman > 0) { @@ -45,19 +62,47 @@ void ffPrintPackages(FFPackagesOptions* options) FF_PRINT_PACKAGE(emerge) FF_PRINT_PACKAGE(eopkg) FF_PRINT_PACKAGE(xbps) - FF_PRINT_PACKAGE_NAME(nixSystem, "nix-system") - FF_PRINT_PACKAGE_NAME(nixUser, "nix-user") - FF_PRINT_PACKAGE_NAME(nixDefault, "nix-default") + if (options->combined) + { + FF_PRINT_PACKAGE_ALL(nix); + } + else + { + FF_PRINT_PACKAGE_NAME(nixSystem, "nix-system") + FF_PRINT_PACKAGE_NAME(nixUser, "nix-user") + FF_PRINT_PACKAGE_NAME(nixDefault, "nix-default") + } FF_PRINT_PACKAGE(apk) FF_PRINT_PACKAGE(pkg) FF_PRINT_PACKAGE(pkgsrc) - FF_PRINT_PACKAGE_NAME(hpkgSystem, counts.hpkgUser ? "hpkg-system" : "hpkg") - FF_PRINT_PACKAGE_NAME(hpkgUser, "hpkg-user") - FF_PRINT_PACKAGE_NAME(flatpakSystem, counts.flatpakUser ? "flatpak-system" : "flatpak") - FF_PRINT_PACKAGE_NAME(flatpakUser, "flatpak-user") + if (options->combined) + { + FF_PRINT_PACKAGE_ALL(hpkg) + } + else + { + FF_PRINT_PACKAGE_NAME(hpkgSystem, counts.hpkgUser ? "hpkg-system" : "hpkg") + FF_PRINT_PACKAGE_NAME(hpkgUser, "hpkg-user") + } + if (options->combined) + { + FF_PRINT_PACKAGE_ALL(flatpak); + } + else + { + FF_PRINT_PACKAGE_NAME(flatpakSystem, counts.flatpakUser ? "flatpak-system" : "flatpak") + FF_PRINT_PACKAGE_NAME(flatpakUser, "flatpak-user") + } FF_PRINT_PACKAGE(snap) - FF_PRINT_PACKAGE(brew) - FF_PRINT_PACKAGE_NAME(brewCask, "brew-cask") + if (options->combined) + { + FF_PRINT_PACKAGE_ALL(brew); + } + else + { + FF_PRINT_PACKAGE_NAME(brew, "brew") + FF_PRINT_PACKAGE_NAME(brewCask, "brew-cask") + } FF_PRINT_PACKAGE(macports) FF_PRINT_PACKAGE(scoop) FF_PRINT_PACKAGE(choco) @@ -65,14 +110,28 @@ void ffPrintPackages(FFPackagesOptions* options) FF_PRINT_PACKAGE(paludis) FF_PRINT_PACKAGE(winget) FF_PRINT_PACKAGE(opkg) - FF_PRINT_PACKAGE_NAME(amSystem, "am") - FF_PRINT_PACKAGE_NAME(amUser, "appman") + if (options->combined) + { + FF_PRINT_PACKAGE_ALL(am); + } + else + { + FF_PRINT_PACKAGE_NAME(amSystem, "am") + FF_PRINT_PACKAGE_NAME(amUser, "appman") + } FF_PRINT_PACKAGE(sorcery) FF_PRINT_PACKAGE(lpkg) FF_PRINT_PACKAGE(lpkgbuild) - FF_PRINT_PACKAGE_NAME(guixSystem, "guix-system") - FF_PRINT_PACKAGE_NAME(guixUser, "guix-user") - FF_PRINT_PACKAGE_NAME(guixHome, "guix-home") + if (options->combined) + { + FF_PRINT_PACKAGE_ALL(guix); + } + else + { + FF_PRINT_PACKAGE_NAME(guixSystem, "guix-system") + FF_PRINT_PACKAGE_NAME(guixUser, "guix-user") + FF_PRINT_PACKAGE_NAME(guixHome, "guix-home") + } FF_PRINT_PACKAGE(linglong) FF_PRINT_PACKAGE(pacstall) FF_PRINT_PACKAGE(mport) @@ -84,11 +143,6 @@ void ffPrintPackages(FFPackagesOptions* options) } else { - uint32_t nixAll = counts.nixDefault + counts.nixSystem + counts.nixUser; - uint32_t flatpakAll = counts.flatpakSystem + counts.flatpakUser; - uint32_t brewAll = counts.brew + counts.brewCask; - uint32_t guixAll = counts.guixSystem + counts.guixUser + counts.guixHome; - uint32_t hpkgAll = counts.hpkgSystem + counts.hpkgUser; FF_PRINT_FORMAT_CHECKED(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){ FF_FORMAT_ARG(counts.all, "all"), FF_FORMAT_ARG(counts.pacman, "pacman"), @@ -248,6 +302,12 @@ bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key, return true; } + if (ffStrEqualsIgnCase(subKey, "combined")) + { + options->combined = ffOptionParseBoolean(value); + return true; + } + return false; } @@ -258,7 +318,7 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if (ffStrEqualsIgnCase(key, "type")) + if (ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) @@ -360,6 +420,12 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) } } + if (ffStrEqualsIgnCase(key, "combined")) + { + options->combined = yyjson_get_bool(val); + continue; + } + ffPrintError(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", key); } } @@ -410,6 +476,9 @@ void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* do FF_TEST_PACKAGE_NAME(XBPS) #undef FF_TEST_PACKAGE_NAME } + + if (options->combined != defaultOptions.combined) + yyjson_mut_obj_add_bool(doc, module, "combined", options->combined); } void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) @@ -536,6 +605,7 @@ void ffInitPackagesOptions(FFPackagesOptions* options) ffOptionInitModuleArg(&options->moduleArgs, "󰏖"); options->disabled = FF_PACKAGES_DISABLE_LIST; + options->combined = false; } void ffDestroyPackagesOptions(FFPackagesOptions* options) diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 80b934f2fe..de67517910 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -159,7 +159,7 @@ void ffParsePhysicalDiskJsonObject(FFPhysicalDiskOptions* options, yyjson_val* m yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/physicalmemory/physicalmemory.c b/src/modules/physicalmemory/physicalmemory.c index 2ee653c59b..5ea3573a9b 100644 --- a/src/modules/physicalmemory/physicalmemory.c +++ b/src/modules/physicalmemory/physicalmemory.c @@ -97,7 +97,7 @@ void ffParsePhysicalMemoryJsonObject(FFPhysicalMemoryOptions* options, yyjson_va yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/player/player.c b/src/modules/player/player.c index 56f1601497..cf9a1b314c 100644 --- a/src/modules/player/player.c +++ b/src/modules/player/player.c @@ -98,7 +98,7 @@ void ffParsePlayerJsonObject(FFPlayerOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/poweradapter/poweradapter.c b/src/modules/poweradapter/poweradapter.c index f99e157837..ee8a613426 100644 --- a/src/modules/poweradapter/poweradapter.c +++ b/src/modules/poweradapter/poweradapter.c @@ -81,7 +81,7 @@ void ffParsePowerAdapterJsonObject(FFPowerAdapterOptions* options, yyjson_val* m yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/processes/processes.c b/src/modules/processes/processes.c index 3f06803e0e..6839642ee7 100644 --- a/src/modules/processes/processes.c +++ b/src/modules/processes/processes.c @@ -46,7 +46,7 @@ void ffParseProcessesJsonObject(FFProcessesOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/publicip/publicip.c b/src/modules/publicip/publicip.c index 71163fbd1c..d712ba1bed 100644 --- a/src/modules/publicip/publicip.c +++ b/src/modules/publicip/publicip.c @@ -74,7 +74,7 @@ void ffParsePublicIpJsonObject(FFPublicIpOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/separator/separator.c b/src/modules/separator/separator.c index 8f9b8f4e5c..aa3e3d58a2 100644 --- a/src/modules/separator/separator.c +++ b/src/modules/separator/separator.c @@ -147,7 +147,7 @@ void ffParseSeparatorJsonObject(FFSeparatorOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffStrEqualsIgnCase(key, "string")) diff --git a/src/modules/shell/shell.c b/src/modules/shell/shell.c index c29fa9d72b..f68cb399d2 100644 --- a/src/modules/shell/shell.c +++ b/src/modules/shell/shell.c @@ -59,7 +59,7 @@ void ffParseShellJsonObject(FFShellOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/sound/sound.c b/src/modules/sound/sound.c index 4dec032acd..f57ebb0916 100644 --- a/src/modules/sound/sound.c +++ b/src/modules/sound/sound.c @@ -143,7 +143,7 @@ void ffParseSoundJsonObject(FFSoundOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/swap/swap.c b/src/modules/swap/swap.c index 1f864562ae..c4a28f67bc 100644 --- a/src/modules/swap/swap.c +++ b/src/modules/swap/swap.c @@ -157,7 +157,7 @@ void ffParseSwapJsonObject(FFSwapOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/terminal/terminal.c b/src/modules/terminal/terminal.c index 265cd7dbdc..dc01af2db2 100644 --- a/src/modules/terminal/terminal.c +++ b/src/modules/terminal/terminal.c @@ -55,7 +55,7 @@ void ffParseTerminalJsonObject(FFTerminalOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/terminalfont/terminalfont.c b/src/modules/terminalfont/terminalfont.c index a8376f586d..219b8fa72c 100644 --- a/src/modules/terminalfont/terminalfont.c +++ b/src/modules/terminalfont/terminalfont.c @@ -63,7 +63,7 @@ void ffParseTerminalFontJsonObject(FFTerminalFontOptions* options, yyjson_val* m yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/terminalsize/terminalsize.c b/src/modules/terminalsize/terminalsize.c index 4639aefc75..389f4d6f03 100644 --- a/src/modules/terminalsize/terminalsize.c +++ b/src/modules/terminalsize/terminalsize.c @@ -55,7 +55,7 @@ void ffParseTerminalSizeJsonObject(FFTerminalSizeOptions* options, yyjson_val* m yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/terminaltheme/terminaltheme.c b/src/modules/terminaltheme/terminaltheme.c index a81971d113..25834d66e1 100644 --- a/src/modules/terminaltheme/terminaltheme.c +++ b/src/modules/terminaltheme/terminaltheme.c @@ -60,7 +60,7 @@ void ffParseTerminalThemeJsonObject(FFTerminalThemeOptions* options, yyjson_val* yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/theme/theme.c b/src/modules/theme/theme.c index 7c4901753d..e99a217796 100644 --- a/src/modules/theme/theme.c +++ b/src/modules/theme/theme.c @@ -60,7 +60,7 @@ void ffParseThemeJsonObject(FFThemeOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/title/title.c b/src/modules/title/title.c index fdd74271e3..02afec2ce9 100644 --- a/src/modules/title/title.c +++ b/src/modules/title/title.c @@ -109,7 +109,7 @@ void ffParseTitleJsonObject(FFTitleOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/tpm/tpm.c b/src/modules/tpm/tpm.c index 8cbbd840da..9d849671a1 100644 --- a/src/modules/tpm/tpm.c +++ b/src/modules/tpm/tpm.c @@ -55,7 +55,7 @@ void ffParseTPMJsonObject(FFTPMOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/uptime/uptime.c b/src/modules/uptime/uptime.c index 64873cc19c..445de7e1fb 100644 --- a/src/modules/uptime/uptime.c +++ b/src/modules/uptime/uptime.c @@ -72,7 +72,7 @@ void ffParseUptimeJsonObject(FFUptimeOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/users/users.c b/src/modules/users/users.c index 74a608eb2f..abea30aa0e 100644 --- a/src/modules/users/users.c +++ b/src/modules/users/users.c @@ -136,7 +136,7 @@ void ffParseUsersJsonObject(FFUsersOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if (ffStrEqualsIgnCase(key, "type")) + if (ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/version/version.c b/src/modules/version/version.c index d49a260655..39a851e326 100644 --- a/src/modules/version/version.c +++ b/src/modules/version/version.c @@ -61,7 +61,7 @@ void ffParseVersionJsonObject(FFVersionOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/vulkan/vulkan.c b/src/modules/vulkan/vulkan.c index a08f4b9bae..d67ca9e703 100644 --- a/src/modules/vulkan/vulkan.c +++ b/src/modules/vulkan/vulkan.c @@ -67,7 +67,7 @@ void ffParseVulkanJsonObject(FFVulkanOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/wallpaper/wallpaper.c b/src/modules/wallpaper/wallpaper.c index 7e5b46af00..bd95a4d0e5 100644 --- a/src/modules/wallpaper/wallpaper.c +++ b/src/modules/wallpaper/wallpaper.c @@ -57,7 +57,7 @@ void ffParseWallpaperJsonObject(FFWallpaperOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/weather/weather.c b/src/modules/weather/weather.c index f63a026e70..78570d0efa 100644 --- a/src/modules/weather/weather.c +++ b/src/modules/weather/weather.c @@ -64,7 +64,7 @@ void ffParseWeatherJsonObject(FFWeatherOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/wifi/wifi.c b/src/modules/wifi/wifi.c index 7bb5f79942..cae5150dda 100644 --- a/src/modules/wifi/wifi.c +++ b/src/modules/wifi/wifi.c @@ -153,7 +153,7 @@ void ffParseWifiJsonObject(FFWifiOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/wm/wm.c b/src/modules/wm/wm.c index f0f0f31b48..5dc4135638 100644 --- a/src/modules/wm/wm.c +++ b/src/modules/wm/wm.c @@ -86,7 +86,7 @@ void ffParseWMJsonObject(FFWMOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/wmtheme/wmtheme.c b/src/modules/wmtheme/wmtheme.c index bfddcfbbae..6659d88e1b 100644 --- a/src/modules/wmtheme/wmtheme.c +++ b/src/modules/wmtheme/wmtheme.c @@ -46,7 +46,7 @@ void ffParseWMThemeJsonObject(FFWMThemeOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) diff --git a/src/modules/zpool/zpool.c b/src/modules/zpool/zpool.c index 5ee356e084..a00274e708 100644 --- a/src/modules/zpool/zpool.c +++ b/src/modules/zpool/zpool.c @@ -126,7 +126,7 @@ void ffParseZpoolJsonObject(FFZpoolOptions* options, yyjson_val* module) yyjson_obj_foreach(module, idx, max, key_, val) { const char* key = yyjson_get_str(key_); - if(ffStrEqualsIgnCase(key, "type")) + if(ffStrEqualsIgnCase(key, "type") || ffStrEqualsIgnCase(key, "condition")) continue; if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))