Compare commits

...

21 Commits

Author SHA1 Message Date
Carter Li 636471c366 Merge pull request #2375 from fastfetch-cli/dev
Release v2.64.2
2026-06-05 18:36:58 +08:00
李通洲 cbc84fda6c Common (Lua): addresses AI's feedback 2026-06-05 18:21:28 +08:00
李通洲 fc7a0a8484 Codec (Linux): supports BINARY_LINK_TYPE=dynamic 2026-06-05 18:05:54 +08:00
李通洲 4d3b6c3b1b Common (QJS): supports BINARY_LINK_TYPE=dynamic 2026-06-05 17:49:49 +08:00
李通洲 70e67177fe Common (Lua): supports BINARY_LINK_TYPE=dynamic 2026-06-05 17:22:16 +08:00
李通洲 9fe7d6dbfa Logo: addresses review comments of AI 2026-06-05 16:34:02 +08:00
Carter Li a139a8c4a5 Doc: updates changelog [ci skip] 2026-06-05 16:22:04 +08:00
Valeriy Kosikhin da568c986e Logo (Builtin): update OpenWrt logo
Update the large logo for OpenWrt based on the official branding.
Add a small logo version.
Keep the old logo as openwrt_old.txt

Signed-off-by: Valeriy Kosikhin <vkosikhin@gmail.com>
2026-06-05 16:15:46 +08:00
Carter Li 727fbc0276 Doc: updates changelog 2026-06-05 15:29:00 +08:00
Carter Li 20aabdfd78 Global: resets keysHeight after every refresh 2026-06-05 15:27:25 +08:00
Carter Li e79aaf5ce1 Global: don't clear line in --logo-position right 2026-06-05 15:27:15 +08:00
Carter Li 53c2d07161 Release: v2.64.2 2026-06-05 14:51:50 +08:00
Carter Li 6b9f594620 Global: prevents ascii logo from being overwritten in --dynamic-interval mode 2026-06-05 14:47:01 +08:00
Carter Li ba3968784f Logo (Image): fixes image renders but quickly gets wiped
Regression from v2.64.0

Fixes: #2374
2026-06-05 13:12:07 +08:00
Carter Li 021ece1681 Merge pull request #2370 from fastfetch-cli/dev
Release: v2.64.1
2026-06-04 23:45:19 +08:00
李通洲 9787b56460 Release: v2.64.1 2026-06-04 20:15:54 +08:00
李通洲 54792e61ff Common (Lua): detects circular reference in encode_json 2026-06-04 20:15:54 +08:00
Carter Li b34e2a4055 Common (Base64): adds static to internal functions 2026-06-04 17:22:24 +08:00
Carter Li 3b56200ee4 Packages: adds option PACKAGES_REMOVE_DISABLED to remove disabled package managers from the build entirely 2026-06-04 17:22:24 +08:00
Carter Li de95a62e2f Codec (macOS): removes usage of JPEG XL; replaces enums with raw constants 2026-06-04 10:48:01 +08:00
Carter Li 72cb64a500 Common (Lua): optimises code; fixes incompatibility against lua 5.3 2026-06-04 10:48:01 +08:00
26 changed files with 379 additions and 239 deletions
+22
View File
@@ -1,3 +1,25 @@
# 2.64.2
Bugfixes:
* Fixes image rendering being wiped quickly (#2374)
* Regression from v2.64.0
* Fixes ASCII logo being overwritten in `--dynamic-interval` mode
* Regression from v2.64.0
Logos:
* Updates OpenWrt and adds a small variant (#2376)
* The old one is renamed to `openwrt_old`
# 2.64.1
Features:
* Adds a CMake option `-DPACKAGES_REMOVE_DISABLED` to remove detection code of disabled packages (`-DPACKAGES_DISABLE_<PACKAGE_NAME>`) for slightly smaller binary size (Packages)
Bugfixes:
* Fixes compatibility issues with Lua 5.3
* Avoid possible infinite recursion in `encode_json` when encoding deeply nested tables or circular references
* Fixes compilation issues when building with old macOS SDKs
# 2.64.0
New **optional build** dependencies:
+32 -5
View File
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
project(fastfetch
VERSION 2.64.0
VERSION 2.64.2
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -134,7 +134,25 @@ if(NOT BINARY_LINK_TYPE IN_LIST BINARY_LINK_TYPE_OPTIONS)
message(FATAL_ERROR "BINARY_LINK_TYPE must be one of ${BINARY_LINK_TYPE_OPTIONS}")
endif()
set(PACKAGE_MANAGERS AM APPIMAGE APK BREW CHOCO DPKG EMERGE EOPKG FLATPAK GUIX LINGLONG LPKG LPKGBUILD MACPORTS NIX OPKG PACMAN PACSTALL PALUDIS PISI PKG PKGTOOL RPM SCOOP SNAP SOAR SORCERY WINGET XBPS)
set(PACKAGE_MANAGERS
AM APK APPIMAGE
BREW
CARDS CHOCO
DPKG
EMERGE EOPKG
FLATPAK
GUIX
HPKG
KISS
LINGLONG LPKG LPKGBUILD
MACPORTS MOSS MPORT
NIX
OPKG
PACMAN PACSTALL PALUDIS PISI PKG PKGSRC PKGTOOL
RPM
SCOOP SNAP SOAR SORCERY
WINGET
XBPS)
foreach(package_manager ${PACKAGE_MANAGERS})
if(package_manager STREQUAL "WINGET")
option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" ON)
@@ -142,6 +160,7 @@ foreach(package_manager ${PACKAGE_MANAGERS})
option(PACKAGES_DISABLE_${package_manager} "Disable ${package_manager} package manager detection by default" OFF)
endif()
endforeach()
option(PACKAGES_REMOVE_DISABLED "Remove disabled package managers from the build entirely, instead of just skipping them at runtime" OFF)
if (LINUX)
set(CUSTOM_PCI_IDS_PATH "" CACHE STRING "Custom path to file pci.ids, defaults to `/usr/share/hwdata/pci.ids`")
@@ -1619,6 +1638,11 @@ function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME) # [CMAKE_TARGET_NAME]
set(${VARNAME}_LIBRARIES ${_FF_CMAKE_TARGET})
endif()
endif()
if(NOT BINARY_LINK_TYPE STREQUAL "dlopen")
# INTERFACE_LINK_LIBRARIES doesn't expose libvarname.a
target_link_libraries(libfastfetch PRIVATE ${_FF_CMAKE_TARGET})
endif()
endif()
else()
set(${VARNAME}_INCLUDE_DIRS ${${CMAKE_NAME}_INCLUDE_DIRS})
@@ -1672,8 +1696,8 @@ ff_lib_enable(DRM
"Libdrm"
)
ff_lib_enable(VA
"libva"
"Libva"
"libva-drm"
"Libva-drm"
)
ff_lib_enable(VDPAU
"vdpau"
@@ -2021,7 +2045,10 @@ else()
list(TRANSFORM PACKAGES_DISABLE_LIST APPEND "_BIT")
list(JOIN PACKAGES_DISABLE_LIST " | " PACKAGES_DISABLE_LIST)
endif()
target_compile_definitions(libfastfetch PRIVATE FF_PACKAGES_DISABLE_LIST=${PACKAGES_DISABLE_LIST})
target_compile_definitions(libfastfetch PRIVATE "FF_PACKAGES_DISABLE_LIST=${PACKAGES_DISABLE_LIST}")
if(PACKAGES_REMOVE_DISABLED)
target_compile_definitions(libfastfetch PRIVATE FF_PACKAGES_REMOVE_DISABLED=1)
endif()
######################
# Executable targets #
+1 -1
View File
@@ -34,7 +34,7 @@ void ffBase64EncodeRaw(uint32_t size, const char* str, uint32_t* out_size, char*
static uint8_t decode_table[256];
void init_decode_table() {
static void init_decode_table() {
uint8_t ch = 0;
do {
int32_t code = -1;
+1 -2
View File
@@ -191,7 +191,7 @@ static bool parseLuaString(FFstrbuf* buffer, const char* script, uint32_t script
lua_pushboolean(L, *(bool*) arg->value);
break;
case FF_ARG_TYPE_STRING:
lua_pushstring(L, (const char*) arg->value);
lua_pushlstring(L, (const char*) arg->value, strlen((const char*) arg->value));
break;
case FF_ARG_TYPE_STRBUF: {
const FFstrbuf* sb = (const FFstrbuf*) arg->value;
@@ -232,7 +232,6 @@ static bool parseLuaString(FFstrbuf* buffer, const char* script, uint32_t script
if (res) {
ffStrbufAppendS(buffer, res);
} else {
// Fallback: use luaL_tolstring to get a reasonable representation
luaL_tolstring(L, 1, NULL);
const char* sval = lua_tolstring(L, -1, NULL);
if (sval) {
+44 -27
View File
@@ -5,7 +5,15 @@
struct FFLuaData luaData;
static yyjson_mut_val* lua2yyjson(lua_State* L, int idx, yyjson_mut_doc* doc) {
static yyjson_mut_val* lua2yyjson(lua_State* L, int idx, yyjson_mut_doc* doc, int depth) {
if (__builtin_expect(depth > 15, false)) {
yyjson_mut_doc_free(doc);
lua_pushlstring(
L, "yyjson: recursion depth exceeded; possible circular reference", strlen("yyjson: recursion depth exceeded; possible circular reference"));
lua_error(L); // noreturn
__builtin_unreachable();
}
if (idx < 0) {
idx = lua_gettop(L) + idx + 1;
}
@@ -66,7 +74,7 @@ static yyjson_mut_val* lua2yyjson(lua_State* L, int idx, yyjson_mut_doc* doc) {
yyjson_mut_val* arr = yyjson_mut_arr(doc);
for (lua_Unsigned i = 1; i <= len; i++) {
lua_rawgeti(L, idx, (lua_Integer) i);
yyjson_mut_val* val = lua2yyjson(L, -1, doc);
yyjson_mut_val* val = lua2yyjson(L, -1, doc, depth + 1);
yyjson_mut_arr_append(arr, val);
lua_pop(L, 1);
}
@@ -80,7 +88,7 @@ static yyjson_mut_val* lua2yyjson(lua_State* L, int idx, yyjson_mut_doc* doc) {
yyjson_mut_val* key = yyjson_mut_strncpy(doc, key_str, klen);
lua_pop(L, 1);
yyjson_mut_val* val = lua2yyjson(L, -1, doc);
yyjson_mut_val* val = lua2yyjson(L, -1, doc, depth + 1);
yyjson_mut_obj_add(obj, key, val);
lua_pop(L, 1);
}
@@ -102,28 +110,35 @@ static int yyjsonEncode(lua_State* L) {
}
yyjson_mut_doc* doc = yyjson_mut_doc_new(NULL);
if (!doc) {
return luaL_error(L, "failed to create yyjson document");
if (__builtin_expect(!doc, false)) {
lua_pushlstring(L, "yyjson: yyjson_mut_doc_new() failed", strlen("yyjson: yyjson_mut_doc_new() failed"));
return lua_error(L);
}
yyjson_mut_val* root = lua2yyjson(L, 1, doc);
yyjson_mut_val* root = lua2yyjson(L, 1, doc, 0);
yyjson_mut_doc_set_root(doc, root);
size_t jsonLen;
yyjson_write_err err = {};
FF_AUTO_FREE const char* jsonStr = yyjson_mut_write_opts(doc, YYJSON_WRITE_ALLOW_INF_AND_NAN | (pretty ? YYJSON_WRITE_PRETTY_TWO_SPACES : 0), NULL, &jsonLen, &err);
if (jsonStr) {
if (__builtin_expect(jsonStr != NULL, true)) {
lua_pushlstring(L, jsonStr, jsonLen);
yyjson_mut_doc_free(doc);
return 1;
} else {
yyjson_mut_doc_free(doc);
return luaL_error(L, "failed to encode JSON: %s", err.msg);
{
FF_STRBUF_AUTO_DESTROY errBuf = ffStrbufCreateStatic("yyjson: yyjson_mut_write_opts() failed: ");
ffStrbufAppendS(&errBuf, err.msg);
lua_pushlstring(L, errBuf.chars, errBuf.length);
}
return lua_error(L); // longjmp
}
}
const char* ffLuaLoadState() {
const char* ffLuaLoadState(void) {
if (luaData.inited) {
if (luaData.L == NULL) {
return "Lua library is not available";
@@ -163,35 +178,37 @@ const char* ffLuaLoadState() {
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(liblua, luaopen_string)
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(liblua, luaopen_table)
#endif
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_settop)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_loadbufferx)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_tolstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_createtable)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushinteger)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushnumber)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushboolean)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushlstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushvalue)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_seti)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushnil)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_setfield)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pcallk)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_gettop)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_tolstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_error)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushcclosure)
#if !FF_DISABLE_DLOPEN
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_checkany)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_loadbufferx)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, luaL_tolstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_callk)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_createtable)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_error)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_gettop)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_isinteger)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_next)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pcallk)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushboolean)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushcclosure)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushinteger)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushlstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushnil)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushnumber)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_pushvalue)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_rawgeti)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_rawlen)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_setfield)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_setglobal)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_seti)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_settop)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_toboolean)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_tointegerx)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_tolstring)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_tonumberx)
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(liblua, luaData, lua_type)
#endif
lua_State* L = ffluaL_newstate();
if (L == NULL) {
+45 -41
View File
@@ -3,16 +3,19 @@
#include "fastfetch.h"
#if FF_HAVE_LUA
// Hack. LUA_API is defined as extern which prevents us from implementing the functions ourselves.
#include <luaconf.h>
#undef LUA_API
#undef LUALIB_API
#undef LUAMOD_API
#define LUA_API static inline
#define LUALIB_API LUA_API
#define LUAMOD_API LUA_API
#if !FF_DISABLE_DLOPEN
// Hack. LUA_API is defined as extern which prevents us from implementing the functions ourselves.
#include <luaconf.h>
#undef LUA_API
#undef LUALIB_API
#undef LUAMOD_API
#define LUA_API static inline
#define LUALIB_API LUA_API
#define LUAMOD_API LUA_API
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
#pragma GCC diagnostic ignored "-Wunused-function"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
@@ -24,48 +27,42 @@
#include "common/library.h"
extern struct FFLuaData {
FF_LIBRARY_SYMBOL(luaL_newstate)
#if LUA_VERSION_NUM >= 505
FF_LIBRARY_SYMBOL(luaL_openselectedlibs)
#else
FF_LIBRARY_SYMBOL(luaL_openlibs)
#endif
FF_LIBRARY_SYMBOL(lua_settop)
FF_LIBRARY_SYMBOL(luaL_loadbufferx)
FF_LIBRARY_SYMBOL(lua_tolstring)
FF_LIBRARY_SYMBOL(lua_createtable)
FF_LIBRARY_SYMBOL(lua_pushinteger)
FF_LIBRARY_SYMBOL(lua_pushnumber)
FF_LIBRARY_SYMBOL(lua_pushboolean)
FF_LIBRARY_SYMBOL(lua_pushstring)
FF_LIBRARY_SYMBOL(lua_pushlstring)
FF_LIBRARY_SYMBOL(lua_pushvalue)
FF_LIBRARY_SYMBOL(lua_seti)
FF_LIBRARY_SYMBOL(lua_pushnil)
FF_LIBRARY_SYMBOL(lua_setfield)
FF_LIBRARY_SYMBOL(lua_pcallk)
FF_LIBRARY_SYMBOL(lua_gettop)
FF_LIBRARY_SYMBOL(luaL_tolstring)
FF_LIBRARY_SYMBOL(luaL_error)
FF_LIBRARY_SYMBOL(lua_pushcclosure)
#if !FF_DISABLE_DLOPEN
FF_LIBRARY_SYMBOL(luaL_checkany)
FF_LIBRARY_SYMBOL(luaL_loadbufferx)
FF_LIBRARY_SYMBOL(luaL_tolstring)
FF_LIBRARY_SYMBOL(lua_callk)
FF_LIBRARY_SYMBOL(lua_createtable)
FF_LIBRARY_SYMBOL(lua_error)
FF_LIBRARY_SYMBOL(lua_gettop)
FF_LIBRARY_SYMBOL(lua_isinteger)
FF_LIBRARY_SYMBOL(lua_next)
FF_LIBRARY_SYMBOL(lua_pcallk)
FF_LIBRARY_SYMBOL(lua_pushboolean)
FF_LIBRARY_SYMBOL(lua_pushcclosure)
FF_LIBRARY_SYMBOL(lua_pushinteger)
FF_LIBRARY_SYMBOL(lua_pushlstring)
FF_LIBRARY_SYMBOL(lua_pushnil)
FF_LIBRARY_SYMBOL(lua_pushnumber)
FF_LIBRARY_SYMBOL(lua_pushvalue)
FF_LIBRARY_SYMBOL(lua_rawgeti)
FF_LIBRARY_SYMBOL(lua_rawlen)
FF_LIBRARY_SYMBOL(lua_setfield)
FF_LIBRARY_SYMBOL(lua_setglobal)
FF_LIBRARY_SYMBOL(lua_seti)
FF_LIBRARY_SYMBOL(lua_settop)
FF_LIBRARY_SYMBOL(lua_toboolean)
FF_LIBRARY_SYMBOL(lua_tointegerx)
FF_LIBRARY_SYMBOL(lua_tolstring)
FF_LIBRARY_SYMBOL(lua_tonumberx)
FF_LIBRARY_SYMBOL(lua_type)
#endif
lua_State* L;
bool inited;
} luaData;
const char* ffLuaLoadState();
#if !FF_DISABLE_DLOPEN
FF_A_ALWAYS_INLINE void(lua_settop)(lua_State* L, int idx) {
return luaData.fflua_settop(L, idx);
}
@@ -94,10 +91,6 @@ FF_A_ALWAYS_INLINE void(lua_pushboolean)(lua_State* L, int b) {
return luaData.fflua_pushboolean(L, b);
}
FF_A_ALWAYS_INLINE const char*(lua_pushstring) (lua_State * L, const char* s) {
return luaData.fflua_pushstring(L, s);
}
FF_A_ALWAYS_INLINE const char*(lua_pushlstring) (lua_State * L, const char* s, size_t len) {
return luaData.fflua_pushlstring(L, s, len);
}
@@ -130,7 +123,9 @@ FF_A_ALWAYS_INLINE const char*(luaL_tolstring) (lua_State * L, int idx, size_t*
return luaData.ffluaL_tolstring(L, idx, len);
}
#define luaL_error(L, fmt, ...) luaData.ffluaL_error(L, fmt, ##__VA_ARGS__)
FF_A_ALWAYS_INLINE int(lua_error)(lua_State* L) {
return luaData.fflua_error(L);
}
FF_A_ALWAYS_INLINE void(lua_pushcclosure)(lua_State* L, lua_CFunction fn, int n) {
return luaData.fflua_pushcclosure(L, fn, n);
@@ -156,7 +151,13 @@ FF_A_ALWAYS_INLINE int(lua_rawgeti)(lua_State* L, int idx, lua_Integer n) {
return luaData.fflua_rawgeti(L, idx, n);
}
FF_A_ALWAYS_INLINE lua_Unsigned(lua_rawlen)(lua_State* L, int idx) {
FF_A_ALWAYS_INLINE
#if LUA_VERSION_NUM > 503
lua_Unsigned
#else
size_t
#endif
(lua_rawlen)(lua_State* L, int idx) {
return luaData.fflua_rawlen(L, idx);
}
@@ -179,5 +180,8 @@ FF_A_ALWAYS_INLINE lua_Number(lua_tonumberx)(lua_State* L, int idx, int* isnum)
FF_A_ALWAYS_INLINE int(lua_type)(lua_State* L, int idx) {
return luaData.fflua_type(L, idx);
}
#endif
const char* ffLuaLoadState(void);
#endif
+1 -2
View File
@@ -24,8 +24,7 @@ typedef enum FF_A_PACKED FFCodecType {
FF_CODEC_TYPE_DOLBY_VISION_HEVC = UINT32_C(1) << 16,
FF_CODEC_TYPE_PRORES = UINT32_C(1) << 17,
FF_CODEC_TYPE_PRORES_RAW = UINT32_C(1) << 18,
FF_CODEC_TYPE_JPEG_XL = UINT32_C(1) << 19,
FF_CODEC_TYPE_MAX = FF_CODEC_TYPE_JPEG_XL,
FF_CODEC_TYPE_MAX = FF_CODEC_TYPE_PRORES_RAW,
FF_CODEC_TYPE_FORCE_UNSIGNED = UINT32_MAX,
} FFCodecType;
+22 -22
View File
@@ -7,28 +7,28 @@ static const struct {
CMVideoCodecType codec;
FFCodecType type;
} FF_CODEC_CODECS[] = {
{ kCMVideoCodecType_H263, FF_CODEC_TYPE_H263 },
{ kCMVideoCodecType_JPEG, FF_CODEC_TYPE_MJPEG },
{ kCMVideoCodecType_JPEG_XL, FF_CODEC_TYPE_JPEG_XL },
{ kCMVideoCodecType_MPEG1Video, FF_CODEC_TYPE_MPEG1 },
{ kCMVideoCodecType_MPEG2Video, FF_CODEC_TYPE_MPEG2 },
{ kCMVideoCodecType_MPEG4Video, FF_CODEC_TYPE_DIVX_XVID },
{ kCMVideoCodecType_H264, FF_CODEC_TYPE_H264 },
{ kCMVideoCodecType_HEVC, FF_CODEC_TYPE_HEVC },
{ kCMVideoCodecType_HEVCWithAlpha, FF_CODEC_TYPE_HEVC },
{ kCMVideoCodecType_DolbyVisionHEVC, FF_CODEC_TYPE_DOLBY_VISION_HEVC },
{ kCMVideoCodecType_DisparityHEVC, FF_CODEC_TYPE_HEVC },
{ kCMVideoCodecType_DepthHEVC, FF_CODEC_TYPE_HEVC },
{ kCMVideoCodecType_VP9, FF_CODEC_TYPE_VP9 },
{ kCMVideoCodecType_AV1, FF_CODEC_TYPE_AV1 },
{ kCMVideoCodecType_AppleProRes4444XQ, FF_CODEC_TYPE_PRORES },
{ kCMVideoCodecType_AppleProRes4444, FF_CODEC_TYPE_PRORES },
{ kCMVideoCodecType_AppleProRes422HQ, FF_CODEC_TYPE_PRORES },
{ kCMVideoCodecType_AppleProRes422, FF_CODEC_TYPE_PRORES },
{ kCMVideoCodecType_AppleProRes422LT, FF_CODEC_TYPE_PRORES },
{ kCMVideoCodecType_AppleProRes422Proxy, FF_CODEC_TYPE_PRORES },
{ kCMVideoCodecType_AppleProResRAW, FF_CODEC_TYPE_PRORES_RAW },
{ kCMVideoCodecType_AppleProResRAWHQ, FF_CODEC_TYPE_PRORES_RAW },
{ 'h263', FF_CODEC_TYPE_H263 }, // kCMVideoCodecType_H263
{ 'jpeg', FF_CODEC_TYPE_MJPEG }, // kCMVideoCodecType_JPEG
{ 'dmb1', FF_CODEC_TYPE_MJPEG }, // kCMVideoCodecType_JPEG_OpenDML
{ 'mp1v', FF_CODEC_TYPE_MPEG1 }, // kCMVideoCodecType_MPEG1Video
{ 'mp2v', FF_CODEC_TYPE_MPEG2 }, // kCMVideoCodecType_MPEG2Video
{ 'mp4v', FF_CODEC_TYPE_DIVX_XVID }, // kCMVideoCodecType_MPEG4Video
{ 'avc1', FF_CODEC_TYPE_H264 }, // kCMVideoCodecType_H264
{ 'hvc1', FF_CODEC_TYPE_HEVC }, // kCMVideoCodecType_HEVC
{ 'muxa', FF_CODEC_TYPE_HEVC }, // kCMVideoCodecType_HEVCWithAlpha
{ 'dvh1', FF_CODEC_TYPE_DOLBY_VISION_HEVC }, // kCMVideoCodecType_DolbyVisionHEVC
{ 'dish', FF_CODEC_TYPE_HEVC }, // kCMVideoCodecType_DisparityHEVC
{ 'deph', FF_CODEC_TYPE_HEVC }, // kCMVideoCodecType_DepthHEVC
{ 'vp09', FF_CODEC_TYPE_VP9 }, // kCMVideoCodecType_VP9
{ 'av01', FF_CODEC_TYPE_AV1 }, // kCMVideoCodecType_AV1
{ 'ap4x', FF_CODEC_TYPE_PRORES }, // kCMVideoCodecType_AppleProRes4444XQ
{ 'ap4h', FF_CODEC_TYPE_PRORES }, // kCMVideoCodecType_AppleProRes4444
{ 'apch', FF_CODEC_TYPE_PRORES }, // kCMVideoCodecType_AppleProRes422HQ
{ 'apcn', FF_CODEC_TYPE_PRORES }, // kCMVideoCodecType_AppleProRes422
{ 'apcs', FF_CODEC_TYPE_PRORES }, // kCMVideoCodecType_AppleProRes422LT
{ 'apco', FF_CODEC_TYPE_PRORES }, // kCMVideoCodecType_AppleProRes422Proxy
{ 'aprn', FF_CODEC_TYPE_PRORES_RAW }, // kCMVideoCodecType_AppleProResRAW
{ 'aprh', FF_CODEC_TYPE_PRORES_RAW }, // kCMVideoCodecType_AppleProResRAWHQ
};
static FFCodecType ffCodecCodecToType(CMVideoCodecType codec) {
+6
View File
@@ -54,6 +54,12 @@ typedef struct FFPackagesResult {
FFstrbuf pacmanBranch;
} FFPackagesResult;
#if FF_PACKAGES_REMOVE_DISABLED
#define FF_PACKAGES_IS_ENABLED(options, pkgName) ({ (void) options; !((FF_PACKAGES_DISABLE_LIST) & (FF_PACKAGES_FLAG_ ## pkgName ## _BIT)); })
#else
#define FF_PACKAGES_IS_ENABLED(options, pkgName) (!((options)->disabled & (FF_PACKAGES_FLAG_ ## pkgName ## _BIT)))
#endif
const char* ffDetectPackages(FFPackagesResult* result, FFPackagesOptions* options);
bool ffPackagesReadCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, const char* filePath, const char* packageId, uint32_t* result);
bool ffPackagesWriteCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, uint32_t num_elements);
+3 -3
View File
@@ -23,7 +23,7 @@ static uint32_t getMacPortsPackages(FFstrbuf* baseDir) {
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreate();
if (!(options->disabled & FF_PACKAGES_FLAG_BREW_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, BREW)) {
const char* prefix = getenv("HOMEBREW_PREFIX");
if (ffStrSet(prefix)) {
ffStrbufSetS(&baseDir, prefix);
@@ -36,7 +36,7 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
}
countBrewPackages(&baseDir, result);
}
if (!(options->disabled & FF_PACKAGES_FLAG_MACPORTS_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, MACPORTS)) {
const char* prefix = getenv("MACPORTS_PREFIX");
if (ffStrSet(prefix)) {
ffStrbufSetS(&baseDir, prefix);
@@ -46,7 +46,7 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
result->macports = getMacPortsPackages(&baseDir);
}
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, NIX)) {
ffStrbufSetS(&baseDir, FASTFETCH_TARGET_DIR_ROOT);
result->nixDefault += ffPackagesGetNix(&baseDir, "/nix/var/nix/profiles/default");
result->nixSystem += ffPackagesGetNix(&baseDir, "/run/current-system");
+2 -2
View File
@@ -19,10 +19,10 @@ static uint32_t getSQLite3Int(const char* dbPath, const char* query, const char*
}
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKG)) {
result->pkg = getSQLite3Int(FASTFETCH_TARGET_DIR_ROOT "/var/db/pkg/local.sqlite", "SELECT count(*) FROM packages", "pkg");
}
if (!(options->disabled & FF_PACKAGES_FLAG_MPORT_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, MPORT)) {
result->mport = getSQLite3Int(FASTFETCH_TARGET_DIR_ROOT "/var/db/mport/master.db", "SELECT count(*) FROM packages", "mport");
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
// TODO: Use the Package Kit C++ API instead (would account for disabled packages)
if (!(options->disabled & FF_PACKAGES_FLAG_HPKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, HPKG)) {
result->hpkgSystem = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/system/packages", false);
result->hpkgUser = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/boot/home/config/packages", false);
}
+34 -34
View File
@@ -459,85 +459,85 @@ static uint32_t getPacmanPackages(FFstrbuf* baseDir) {
}
static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts, FFPackagesOptions* options) {
if (!(options->disabled & FF_PACKAGES_FLAG_APK_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, APK)) {
packageCounts->apk += getNumStrings(baseDir, "/lib/apk/db/installed", "C:Q", "apk");
}
if (!(options->disabled & FF_PACKAGES_FLAG_DPKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, DPKG)) {
packageCounts->dpkg += getNumStrings(baseDir, "/var/lib/dpkg/status", "Status: install ok installed", "dpkg");
}
if (!(options->disabled & FF_PACKAGES_FLAG_LPKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, LPKG)) {
packageCounts->lpkg += getNumStrings(baseDir, "/opt/Loc-OS-LPKG/installed-lpkg/Listinstalled-lpkg.list", "\n", "lpkg");
}
if (!(options->disabled & FF_PACKAGES_FLAG_EMERGE_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, EMERGE)) {
packageCounts->emerge += countFilesRecursive(baseDir, "/var/db/pkg", "SIZE");
}
if (!(options->disabled & FF_PACKAGES_FLAG_EOPKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, EOPKG)) {
packageCounts->eopkg += getNumElements(baseDir, "/var/lib/eopkg/package", true);
}
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, FLATPAK)) {
packageCounts->flatpakSystem += getFlatpakPackages(baseDir, "/var/lib");
}
if (!(options->disabled & FF_PACKAGES_FLAG_KISS_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, KISS)) {
packageCounts->kiss += getNumElements(baseDir, "/var/db/kiss/installed", true);
}
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, NIX)) {
packageCounts->nixDefault += ffPackagesGetNix(baseDir, "/nix/var/nix/profiles/default");
packageCounts->nixSystem += ffPackagesGetNix(baseDir, "/run/current-system");
}
if (!(options->disabled & FF_PACKAGES_FLAG_PACMAN_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PACMAN)) {
packageCounts->pacman += getPacmanPackages(baseDir);
}
if (!(options->disabled & FF_PACKAGES_FLAG_LPKGBUILD_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, LPKGBUILD)) {
packageCounts->lpkgbuild += getNumElements(baseDir, "/opt/Loc-OS-LPKG/lpkgbuild/remove", false);
}
if (!(options->disabled & FF_PACKAGES_FLAG_PKGTOOL_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKGTOOL)) {
packageCounts->pkgtool += getNumElements(baseDir, "/var/log/packages", false);
}
if (!(options->disabled & FF_PACKAGES_FLAG_RPM_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, RPM)) {
// `Sigmd5` is the only table that doesn't contain the virtual `gpg-pubkey` package
packageCounts->rpm += getSQLite3Int(baseDir, "/var/lib/rpm/rpmdb.sqlite", "SELECT count(*) FROM Sigmd5", "rpm");
}
if (!(options->disabled & FF_PACKAGES_FLAG_SNAP_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, SNAP)) {
packageCounts->snap += getSnap(baseDir);
}
if (!(options->disabled & FF_PACKAGES_FLAG_XBPS_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, XBPS)) {
packageCounts->xbps += getXBPS(baseDir, "/var/db/xbps");
}
if (!(options->disabled & FF_PACKAGES_FLAG_BREW_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, BREW)) {
packageCounts->brewCask += getNumElements(baseDir, "/home/linuxbrew/.linuxbrew/Caskroom", true);
packageCounts->brew += getNumElements(baseDir, "/home/linuxbrew/.linuxbrew/Cellar", true);
}
if (!(options->disabled & FF_PACKAGES_FLAG_PALUDIS_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PALUDIS)) {
packageCounts->paludis += countFilesRecursive(baseDir, "/var/db/paludis/repositories", "environment.bz2");
}
if (!(options->disabled & FF_PACKAGES_FLAG_OPKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, OPKG)) {
packageCounts->opkg += getNumStrings(baseDir, "/usr/lib/opkg/status", "Package:", "opkg"); // openwrt
}
if (!(options->disabled & FF_PACKAGES_FLAG_AM_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, AM)) {
packageCounts->amSystem = getAMSystem(baseDir);
}
if (!(options->disabled & FF_PACKAGES_FLAG_SORCERY_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, SORCERY)) {
packageCounts->sorcery += getNumStrings(baseDir, "/var/state/sorcery/packages", ":installed:", "sorcery");
}
if (!(options->disabled & FF_PACKAGES_FLAG_GUIX_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, GUIX)) {
packageCounts->guixSystem += getGuixPackages(baseDir, "/run/current-system/profile");
}
if (!(options->disabled & FF_PACKAGES_FLAG_LINGLONG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, LINGLONG)) {
packageCounts->linglong += getNumElements(baseDir, "/var/lib/linglong/layers", true);
}
if (!(options->disabled & FF_PACKAGES_FLAG_PACSTALL_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PACSTALL)) {
packageCounts->pacstall += getNumElements(baseDir, "/var/lib/pacstall/metadata", false);
}
if (!(options->disabled & FF_PACKAGES_FLAG_PISI_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PISI)) {
packageCounts->pisi += getNumElements(baseDir, "/var/lib/pisi/package", true);
}
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKGSRC)) {
packageCounts->pkgsrc += getNumElements(baseDir, "/usr/pkg/pkgdb", DT_DIR);
}
if (!(options->disabled & FF_PACKAGES_FLAG_MOSS_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, MOSS)) {
packageCounts->moss += getSQLite3Int(baseDir, "/.moss/db/state", "SELECT COUNT(*) FROM state_selections WHERE state_id = (SELECT MAX(id) FROM state)", "moss");
}
if (!(options->disabled & FF_PACKAGES_FLAG_CARDS_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, CARDS)) {
packageCounts->cards += getNumElements(baseDir, "/var/lib/pkg/DB", true);
}
}
@@ -545,7 +545,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
static void getPackageCountsRegular(FFstrbuf* baseDir, FFPackagesResult* packageCounts, FFPackagesOptions* options) {
getPackageCounts(baseDir, packageCounts, options);
if (!(options->disabled & FF_PACKAGES_FLAG_PACMAN_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PACMAN)) {
uint32_t baseDirLength = baseDir->length;
ffStrbufAppendS(baseDir, FASTFETCH_TARGET_DIR_ETC "/pacman-mirrors.conf");
if (ffParsePropFile(baseDir->chars, "Branch =", &packageCounts->pacmanBranch) && packageCounts->pacmanBranch.length == 0) {
@@ -600,13 +600,13 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
// This is needed on openSUSE, which seems to use a proprietary database file
// This method doesn't work on bedrock, so we do it here.
#ifdef FF_HAVE_RPM
if (!(options->disabled & FF_PACKAGES_FLAG_RPM_BIT) && result->rpm == 0) {
if (FF_PACKAGES_IS_ENABLED(options, RPM) && result->rpm == 0) {
result->rpm = getRpmFromLibrpm();
}
#endif
ffStrbufSet(&baseDir, &instance.state.platform.homeDir);
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, NIX)) {
// Count packages from $HOME/.nix-profile
result->nixUser += ffPackagesGetNix(&baseDir, ".nix-profile");
@@ -627,24 +627,24 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
result->nixUser += ffPackagesGetNix(&userPkgsDir, instance.state.platform.userName.chars);
}
if (!(options->disabled & FF_PACKAGES_FLAG_GUIX_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, GUIX)) {
result->guixUser += getGuixPackages(&baseDir, ".guix-profile");
result->guixHome += getGuixPackages(&baseDir, ".guix-home/profile");
}
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, FLATPAK)) {
result->flatpakUser = getFlatpakPackages(&baseDir, "/.local/share");
}
if (!(options->disabled & FF_PACKAGES_FLAG_AM_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, AM)) {
result->amUser = getAMUser();
}
if (!(options->disabled & FF_PACKAGES_FLAG_SOAR_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, SOAR)) {
result->soar += getSQLite3Int(&baseDir, ".local/share/soar/db/soar.db", "SELECT COUNT(DISTINCT pkg_id || pkg_name) FROM packages WHERE is_installed = true", "soar");
}
if (!(options->disabled & FF_PACKAGES_FLAG_APPIMAGE_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, APPIMAGE)) {
result->appimage += getNumElementsBySuffix(&baseDir, "/AppImages", ".appimage");
result->appimage += getNumElementsBySuffix(&baseDir, "/Applications", ".appimage");
}
+1 -1
View File
@@ -3,7 +3,7 @@
#include "common/io.h"
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKGSRC)) {
result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/usr/pkg/pkgdb", true);
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
#include "common/io.h"
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKG)) {
result->pkg = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/var/db/pkg", true);
}
}
+2 -2
View File
@@ -2,7 +2,7 @@
#include <dirent.h>
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKG)) {
yyjson_doc* doc = yyjson_read_file(FASTFETCH_TARGET_DIR_ROOT "/var/pkg/state/installed/catalog.attrs", YYJSON_READ_NOFLAG, NULL, NULL);
if (doc) {
yyjson_val* packageCount = yyjson_obj_get(yyjson_doc_get_root(doc), "package-count");
@@ -11,7 +11,7 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
}
}
}
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PKGSRC)) {
result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/usr/pkg/pkgdb", true);
}
}
+4 -4
View File
@@ -188,16 +188,16 @@ static void detectWinget(FFPackagesResult* result) {
}
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options) {
if (!(options->disabled & FF_PACKAGES_FLAG_SCOOP_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, SCOOP)) {
detectScoop(result);
}
if (!(options->disabled & FF_PACKAGES_FLAG_CHOCO_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, CHOCO)) {
detectChoco(result);
}
if (!(options->disabled & FF_PACKAGES_FLAG_PACMAN_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, PACMAN)) {
detectPacman(result);
}
if (!(options->disabled & FF_PACKAGES_FLAG_WINGET_BIT)) {
if (FF_PACKAGES_IS_ENABLED(options, WINGET)) {
detectWinget(result);
}
}
+4 -1
View File
@@ -765,9 +765,12 @@ static void run(FFdata* data) {
}
if (instance.state.dynamicInterval > 0) {
ffLogoPrintRemaining(); // `logoLineCacheClear` inside so that ffLogoPrintLine will use `\e[nC` to move the cursor to the right position instead of reprinting the logo
fputs("\e[J", stdout); // Clear from cursor to the end of the screen to prevent artifacts when the new output is shorter than the previous one
fflush(stdout);
ffTimeSleep(instance.state.dynamicInterval);
fputs("\e[H", stdout);
fputs("\e[H", stdout); // Move cursor to the top left corner to overwrite the previous output
instance.state.keysHeight = 0; // Reset keysHeight so `ffLogoPrintRemaining` will recalculate it
} else {
break;
}
+28
View File
@@ -291,6 +291,34 @@ static const FFlogo O[] = {
{
.names = { "openwrt" },
.lines = FASTFETCH_DATATEXT_LOGO_OPENWRT,
.colors = {
FF_COLOR_FG_DEFAULT,
FF_COLOR_FG_BLUE,
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_DEFAULT,
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_OPENWRT_SMALL
// OpenWrtSmall
{
.names = { "openwrt_small" },
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_OPENWRT_SMALL,
.colors = {
FF_COLOR_FG_DEFAULT,
FF_COLOR_FG_BLUE,
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_DEFAULT,
},
#endif
#ifdef FASTFETCH_DATATEXT_LOGO_OPENWRT_OLD
// OpenWrtOld
{
.names = { "openwrt_old" },
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_OPENWRT_OLD,
.colors = {
FF_COLOR_FG_BLUE,
},
+18 -9
View File
@@ -1,9 +1,18 @@
_______
| |.-----.-----.-----.
| - || _ | -__| |
|_______|| __|_____|__|__|
|__|
________ __
| | | |.----.| |_
| | | || _|| _|
|________||__| |____|
..,,..
,;odOMMMMMMMMObo:.
,odOMMMMMO""''""OMMMMMObo.
.dMMMM" .,,. "OMMMb,
'0" ,;ddMMMMMMMMbb:. "0'
oOMMMMO""''""OMMMMOo
$2;. $1'0" .,,. "0' $2.:
.OMM* $1.odMMMMMMbo. $2*MMO.
MMMO $1"0"````"0" $2OMMM
iOMM $1.oo. $2MMMi
OMMl $1:MMMM: $2lMMO
iMMM $1'oo' $2MMMi
OMMb $2dMMO
'OMMO. ,OMMO'
"MMMb. ,dMMM"
"MMMMbgo-,,-ogdMMMM"
"*MMMMMMMMMM*"
`'""'`
+9
View File
@@ -0,0 +1,9 @@
_______
| |.-----.-----.-----.
| - || _ | -__| |
|_______|| __|_____|__|__|
|__|
________ __
| | | |.----.| |_
| | | || _|| _|
|________||__| |____|
+9
View File
@@ -0,0 +1,9 @@
..,..
,odM"""""Mbo,
`.odMMMMMbo.`
$2d,$1" ,mmm, "$2,b
iM $1" . " $2Mi
Ml $1dMb $2lM
'M, $1' $2.M'
"0b. ,d0"
`"WWWWW"`
+33 -31
View File
@@ -461,7 +461,7 @@ static bool updateLogoPath(void) {
return true;
}
#if !FF_MODULE_DISABLE_MEDIA
#if !FF_MODULE_DISABLE_MEDIA
if (ffStrbufIgnCaseEqualS(&options->source, "media-cover")) {
const FFMediaResult* media = ffDetectMedia(true);
if (media->cover.length == 0) {
@@ -470,7 +470,7 @@ static bool updateLogoPath(void) {
ffStrbufSet(&options->source, &media->cover);
return true;
}
#endif
#endif
FF_STRBUF_AUTO_DESTROY fullPath = ffStrbufCreateA(128);
if (ffPathExpandEnv(options->source.chars, &fullPath) && ffPathExists(fullPath.chars, FF_PATHTYPE_FILE)) {
@@ -639,7 +639,7 @@ void ffLogoPrint(void) {
}
if (!ffStrbufEndsWithIgnCaseS(&options->source, ".txt")) {
#if !FF_MODULE_DISABLE_TERMINAL
#if !FF_MODULE_DISABLE_TERMINAL
const FFTerminalResult* terminal = ffDetectTerminal();
bool supportsIterm2 = ffStrbufEqualS(&terminal->prettyName, "iTerm");
@@ -655,15 +655,15 @@ void ffLogoPrint(void) {
ffStrbufIgnCaseEqualS(&terminal->processName, "wezterm") ||
ffStrbufIgnCaseEqualS(&terminal->processName, "wayst") ||
ffStrbufIgnCaseEqualS(&terminal->processName, "ghostty") ||
#ifdef __APPLE__
#ifdef __APPLE__
ffStrbufIgnCaseEqualS(&terminal->processName, "WarpTerminal") ||
#else
#else
ffStrbufIgnCaseEqualS(&terminal->processName, "warp") ||
#endif
#endif
false;
#else
#else
bool supportsKitty = false;
#endif
#endif
// Try to load the logo as an image. If it succeeds, print it and return.
if (logoPrintImageIfExists(supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false)) {
@@ -685,37 +685,39 @@ void ffLogoPrint(void) {
}
void ffLogoPrintLine(void) {
uint32_t printedLineWidth = 0;
FFLogoLineCacheState* cache = &instance.state.logoLineCache;
FFOptionsLogo* logo = &instance.config.logo;
if (cache->lines.length > 0 && (logo->position == FF_LOGO_POSITION_LEFT || logo->position == FF_LOGO_POSITION_RIGHT) && cache->nextLine < cache->lines.length) {
FFLogoCachedLine* line = FF_LIST_GET(FFLogoCachedLine, cache->lines, cache->nextLine);
if (cache->lines.length > 0) {
// Line cache is enabled. Always move cursor with whitespaces to make lolcat happy
if (cache->nextLine < cache->lines.length) {
// Print logo line and move cursor
FFLogoCachedLine* line = FF_LIST_GET(FFLogoCachedLine, cache->lines, cache->nextLine);
if (logo->position == FF_LOGO_POSITION_RIGHT && line->chars.length > 0) {
printf("\033[9999999C\033[%uD", cache->rightOffset);
ffStrbufWriteTo(&line->chars, stdout);
fputs("\033[G", stdout);
} else {
ffStrbufWriteTo(&line->chars, stdout);
printedLineWidth = line->width;
if (logo->position == FF_LOGO_POSITION_RIGHT) {
printf("\033[9999999C\033[%uD", cache->rightOffset);
ffStrbufWriteTo(&line->chars, stdout);
fputs("\033[G", stdout);
} else {
ffStrbufWriteTo(&line->chars, stdout);
uint32_t remaining = instance.state.logoWidth;
remaining = line->width < remaining ? remaining - line->width : 0;
ffPrintCharTimes(' ', remaining);
}
++cache->nextLine;
} else if (logo->position == FF_LOGO_POSITION_LEFT) {
// Move cursor to the start position
ffPrintCharTimes(' ', instance.state.logoWidth);
}
++cache->nextLine;
} else if (instance.state.logoWidth > 0) {
printf("\033[%uC", instance.state.logoWidth);
}
if (instance.state.logoWidth > 0) {
if (instance.config.logo.position == FF_LOGO_POSITION_LEFT) {
uint32_t remaining = instance.state.logoWidth;
remaining = printedLineWidth < remaining ? remaining - printedLineWidth : 0;
ffPrintCharTimes(' ', remaining);
} else {
printf("\033[%uC", instance.state.logoWidth);
}
}
if (instance.state.dynamicInterval > 0) {
if (instance.state.dynamicInterval > 0 && logo->position == FF_LOGO_POSITION_LEFT) {
fputs("\033[K", stdout); // Clear to the end of the line
// Note that we don't clear the line when the logo is on the right, as it will also clear the logo itself
}
++instance.state.keysHeight;
-2
View File
@@ -41,8 +41,6 @@ static const char* ffCodecTypeToString(FFCodecType type) {
return "Apple ProRes";
case FF_CODEC_TYPE_PRORES_RAW:
return "Apple ProRes RAW";
case FF_CODEC_TYPE_JPEG_XL:
return "JPEG XL";
case FF_CODEC_TYPE_UNKNOWN:
default:
return "Unknown";
+37 -35
View File
@@ -4,41 +4,41 @@
typedef enum FF_A_PACKED FFPackagesFlags {
FF_PACKAGES_FLAG_NONE = 0,
FF_PACKAGES_FLAG_APK_BIT = 1ULL << 0,
FF_PACKAGES_FLAG_BREW_BIT = 1ULL << 1,
FF_PACKAGES_FLAG_CHOCO_BIT = 1ULL << 2,
FF_PACKAGES_FLAG_DPKG_BIT = 1ULL << 3,
FF_PACKAGES_FLAG_EMERGE_BIT = 1ULL << 4,
FF_PACKAGES_FLAG_EOPKG_BIT = 1ULL << 5,
FF_PACKAGES_FLAG_FLATPAK_BIT = 1ULL << 6,
FF_PACKAGES_FLAG_NIX_BIT = 1ULL << 7,
FF_PACKAGES_FLAG_OPKG_BIT = 1ULL << 8,
FF_PACKAGES_FLAG_PACMAN_BIT = 1ULL << 9,
FF_PACKAGES_FLAG_PALUDIS_BIT = 1ULL << 10,
FF_PACKAGES_FLAG_PKG_BIT = 1ULL << 11,
FF_PACKAGES_FLAG_PKGTOOL_BIT = 1ULL << 12,
FF_PACKAGES_FLAG_MACPORTS_BIT = 1ULL << 13,
FF_PACKAGES_FLAG_RPM_BIT = 1ULL << 14,
FF_PACKAGES_FLAG_SCOOP_BIT = 1ULL << 15,
FF_PACKAGES_FLAG_SNAP_BIT = 1ULL << 16,
FF_PACKAGES_FLAG_WINGET_BIT = 1ULL << 17,
FF_PACKAGES_FLAG_XBPS_BIT = 1ULL << 18,
FF_PACKAGES_FLAG_AM_BIT = 1ULL << 19,
FF_PACKAGES_FLAG_SORCERY_BIT = 1ULL << 20,
FF_PACKAGES_FLAG_LPKG_BIT = 1ULL << 21,
FF_PACKAGES_FLAG_LPKGBUILD_BIT = 1ULL << 22,
FF_PACKAGES_FLAG_GUIX_BIT = 1ULL << 23,
FF_PACKAGES_FLAG_LINGLONG_BIT = 1ULL << 24,
FF_PACKAGES_FLAG_PACSTALL_BIT = 1ULL << 25,
FF_PACKAGES_FLAG_MPORT_BIT = 1ULL << 26,
FF_PACKAGES_FLAG_PKGSRC_BIT = 1ULL << 27,
FF_PACKAGES_FLAG_HPKG_BIT = 1ULL << 28,
FF_PACKAGES_FLAG_PISI_BIT = 1ULL << 29,
FF_PACKAGES_FLAG_SOAR_BIT = 1ULL << 30,
FF_PACKAGES_FLAG_KISS_BIT = 1ULL << 31,
FF_PACKAGES_FLAG_MOSS_BIT = 1ULL << 32,
FF_PACKAGES_FLAG_APPIMAGE_BIT = 1ULL << 33,
FF_PACKAGES_FLAG_CARDS_BIT = 1ULL << 34,
FF_PACKAGES_FLAG_APK_BIT = UINT64_C(1) << 0U,
FF_PACKAGES_FLAG_BREW_BIT = UINT64_C(1) << 1U,
FF_PACKAGES_FLAG_CHOCO_BIT = UINT64_C(1) << 2U,
FF_PACKAGES_FLAG_DPKG_BIT = UINT64_C(1) << 3U,
FF_PACKAGES_FLAG_EMERGE_BIT = UINT64_C(1) << 4U,
FF_PACKAGES_FLAG_EOPKG_BIT = UINT64_C(1) << 5U,
FF_PACKAGES_FLAG_FLATPAK_BIT = UINT64_C(1) << 6U,
FF_PACKAGES_FLAG_NIX_BIT = UINT64_C(1) << 7U,
FF_PACKAGES_FLAG_OPKG_BIT = UINT64_C(1) << 8U,
FF_PACKAGES_FLAG_PACMAN_BIT = UINT64_C(1) << 9U,
FF_PACKAGES_FLAG_PALUDIS_BIT = UINT64_C(1) << 10U,
FF_PACKAGES_FLAG_PKG_BIT = UINT64_C(1) << 11U,
FF_PACKAGES_FLAG_PKGTOOL_BIT = UINT64_C(1) << 12U,
FF_PACKAGES_FLAG_MACPORTS_BIT = UINT64_C(1) << 13U,
FF_PACKAGES_FLAG_RPM_BIT = UINT64_C(1) << 14U,
FF_PACKAGES_FLAG_SCOOP_BIT = UINT64_C(1) << 15U,
FF_PACKAGES_FLAG_SNAP_BIT = UINT64_C(1) << 16U,
FF_PACKAGES_FLAG_WINGET_BIT = UINT64_C(1) << 17U,
FF_PACKAGES_FLAG_XBPS_BIT = UINT64_C(1) << 18U,
FF_PACKAGES_FLAG_AM_BIT = UINT64_C(1) << 19U,
FF_PACKAGES_FLAG_SORCERY_BIT = UINT64_C(1) << 20U,
FF_PACKAGES_FLAG_LPKG_BIT = UINT64_C(1) << 21U,
FF_PACKAGES_FLAG_LPKGBUILD_BIT = UINT64_C(1) << 22U,
FF_PACKAGES_FLAG_GUIX_BIT = UINT64_C(1) << 23U,
FF_PACKAGES_FLAG_LINGLONG_BIT = UINT64_C(1) << 24U,
FF_PACKAGES_FLAG_PACSTALL_BIT = UINT64_C(1) << 25U,
FF_PACKAGES_FLAG_MPORT_BIT = UINT64_C(1) << 26U,
FF_PACKAGES_FLAG_PKGSRC_BIT = UINT64_C(1) << 27U,
FF_PACKAGES_FLAG_HPKG_BIT = UINT64_C(1) << 28U,
FF_PACKAGES_FLAG_PISI_BIT = UINT64_C(1) << 29U,
FF_PACKAGES_FLAG_SOAR_BIT = UINT64_C(1) << 30U,
FF_PACKAGES_FLAG_KISS_BIT = UINT64_C(1) << 31U,
FF_PACKAGES_FLAG_MOSS_BIT = UINT64_C(1) << 32U,
FF_PACKAGES_FLAG_APPIMAGE_BIT = UINT64_C(1) << 33U,
FF_PACKAGES_FLAG_CARDS_BIT = UINT64_C(1) << 34U,
FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT64_MAX,
} FFPackagesFlags;
static_assert(sizeof(FFPackagesFlags) == sizeof(uint64_t), "");
@@ -46,7 +46,9 @@ static_assert(sizeof(FFPackagesFlags) == sizeof(uint64_t), "");
typedef struct FFPackagesOptions {
FFModuleArgs moduleArgs;
#if !FF_PACKAGES_REMOVE_DISABLED
FFPackagesFlags disabled;
#endif
bool combined;
} FFPackagesOptions;
+19 -13
View File
@@ -211,6 +211,7 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) {
continue;
}
#if !FF_PACKAGES_REMOVE_DISABLED
if (unsafe_yyjson_equals_str(key, "disabled")) {
if (!yyjson_is_null(val) && !yyjson_is_arr(val)) {
ffPrintError(FF_PACKAGES_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid JSON value for %s", unsafe_yyjson_get_str(key));
@@ -229,10 +230,10 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) {
}
const char* flag = unsafe_yyjson_get_str(flagObj);
#define FF_TEST_PACKAGE_NAME(name) \
else if (ffStrEqualsIgnCase(flag, #name)) { \
options->disabled |= FF_PACKAGES_FLAG_##name##_BIT; \
}
#define FF_TEST_PACKAGE_NAME(name) \
else if (ffStrEqualsIgnCase(flag, #name)) { \
options->disabled |= FF_PACKAGES_FLAG_##name##_BIT; \
}
switch (toupper(flag[0])) {
case 'A':
if (false)
@@ -342,11 +343,12 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) {
FF_TEST_PACKAGE_NAME(XBPS)
break;
}
#undef FF_TEST_PACKAGE_NAME
#undef FF_TEST_PACKAGE_NAME
}
continue;
}
}
#endif
if (unsafe_yyjson_equals_str(key, "combined")) {
options->combined = yyjson_get_bool(val);
@@ -360,14 +362,15 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) {
void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
#if !FF_PACKAGES_REMOVE_DISABLED
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "disabled");
#define FF_TEST_PACKAGE_NAME(name) \
else if ((options->disabled & FF_PACKAGES_FLAG_##name##_BIT)) { \
ffStrbufSetS(&buf, #name); \
ffStrbufLowerCase(&buf); \
yyjson_mut_arr_add_strbuf(doc, arr, &buf); \
}
#define FF_TEST_PACKAGE_NAME(name) \
else if ((options->disabled & FF_PACKAGES_FLAG_##name##_BIT)) { \
ffStrbufSetS(&buf, #name); \
ffStrbufLowerCase(&buf); \
yyjson_mut_arr_add_strbuf(doc, arr, &buf); \
}
if (false)
;
FF_TEST_PACKAGE_NAME(AM)
@@ -405,12 +408,13 @@ void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* do
FF_TEST_PACKAGE_NAME(SORCERY)
FF_TEST_PACKAGE_NAME(WINGET)
FF_TEST_PACKAGE_NAME(XBPS)
#undef FF_TEST_PACKAGE_NAME
#undef FF_TEST_PACKAGE_NAME
#endif
yyjson_mut_obj_add_bool(doc, module, "combined", options->combined);
}
bool ffGeneratePackagesJsonResult(FF_A_UNUSED FFPackagesOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
bool ffGeneratePackagesJsonResult(FFPackagesOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
FFPackagesResult counts = {};
ffStrbufInit(&counts.pacmanBranch);
@@ -481,7 +485,9 @@ bool ffGeneratePackagesJsonResult(FF_A_UNUSED FFPackagesOptions* options, yyjson
void ffInitPackagesOptions(FFPackagesOptions* options) {
ffOptionInitModuleArg(&options->moduleArgs, "󰏖");
#if !FF_PACKAGES_REMOVE_DISABLED
options->disabled = FF_PACKAGES_DISABLE_LIST;
#endif
options->combined = false;
}