diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ff4f4b9f5..2951e78c56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,6 +158,41 @@ jobs: name: fastfetch-linux-aarch64 path: ./fastfetch-*.* + linux-armv7: + name: Linux-armv7 + runs-on: ubuntu-22.04 + permissions: + security-events: write + contents: read + steps: + - name: checkout repository + uses: actions/checkout@v4 + + - name: run VM + uses: uraimo/run-on-arch-action@v2 + id: runcmd + with: + arch: armv7 + distro: ubuntu22.04 + githubToken: ${{ github.token }} + run: | + uname -a + apt-get update && apt-get install -y cmake make g++ libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libdrm-dev libddcutil-dev libchafa-dev directx-headers-dev rpm + cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr . + cmake --build . --target package --verbose -j4 + ./fastfetch --list-features + time ./fastfetch -c presets/ci.jsonc + time ./fastfetch -c presets/ci.jsonc --format json + time ./flashfetch + ldd fastfetch + ctest + + - name: upload artifacts + uses: actions/upload-artifact@v4 + with: + name: fastfetch-linux-armv7 + path: ./fastfetch-*.* + musl-amd64: name: Musl-amd64 runs-on: ubuntu-latest @@ -501,6 +536,7 @@ jobs: needs: - linux-amd64 - linux-aarch64 + - linux-armv7 - musl-amd64 - musl-aarch64 - macos-universal diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c6c673fe7..c7146589ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# 2.11.1 + +Hotfix for Android + +Bugfixes: +* Fix uninitialized variables which can cause crashes (#760 #838, Battery, Android) +* Don't detect hyfetch as shell when used as a backend of hyfetch +* Fix incorrect information in man page + +Features: +* Support sorcery package manager detection (Packages, Linux) +* Make `--custom-format` optional (Custom) +* Make `/` an alias of `C:\` for `--disk-folders` (Disk, Windows) + +Logo: +* Fix colors of Source Mage logo + + # 2.11.0 Changes: diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bcbb32cb3..23f578245f 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.11.0 + VERSION 2.11.1 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" diff --git a/doc/fastfetch.1.in b/doc/fastfetch.1.in index 5acbfd9954..ab39ae0b40 100644 --- a/doc/fastfetch.1.in +++ b/doc/fastfetch.1.in @@ -125,7 +125,7 @@ The specified configuration/preset files are searched in the following order: When both a '.jsonc' and a '.conf' file with the same name is found, the '.jsonc' file is preferred. -Fastfetch provides some default presets. List them with \fB \-\-print\-available\-presets\fR. +Fastfetch provides some default presets. List them with \fB\-\-list\-presets\fR. .SH "SEE ALSO" .BR neofetch (1) diff --git a/doc/json_schema.json b/doc/json_schema.json index 5804b2292d..e9ea50c261 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -1117,6 +1117,9 @@ "maxItems": 2 } } + }, + "key": { + "$ref": "#/$defs/key" } } }, @@ -1174,10 +1177,7 @@ "description": "Text to print", "type": "string" } - }, - "required": [ - "format" - ] + } }, { "title": "Display", @@ -1238,7 +1238,7 @@ }, "folders": { "type": "string", - "description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: auto detection using mount-points" + "description": "A colon (semicolon on Windows) separated list of folder paths for the disk output\nDefault: auto detection using mount-points\nThis option overrides other `show*` options" }, "showExternal": { "type": "boolean", diff --git a/presets/examples/11.jsonc b/presets/examples/11.jsonc index b235b05f59..1daee9b51b 100644 --- a/presets/examples/11.jsonc +++ b/presets/examples/11.jsonc @@ -1,5 +1,5 @@ { - "$schema": "file:///C:/msys64/home/zhang/fastfetch/doc/json_schema.json", + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", "logo": { "type": "small" }, diff --git a/presets/examples/13.jsonc b/presets/examples/13.jsonc new file mode 100644 index 0000000000..d4ff95a299 --- /dev/null +++ b/presets/examples/13.jsonc @@ -0,0 +1,85 @@ +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + "type": "small", + "padding": { + "top": 1 + } + }, + "display": { + "separator": "", + "keyWidth": 15 + }, + "modules": [ + { + "key": "╭───────────╮", + "type": "custom" + }, + { + // draw borders first to make colors of left and right border consistant + "key": "│ │\u001b[11D\u001b[31m user", + "type": "title", + "format": "{1}" + }, + { + "key": "│ │\u001b[11D\u001b[32m󰇅 hname", + "type": "title", + "format": "{2}" + }, + { + "key": "│ │\u001b[11D\u001b[33m󰅐 uptime", + "type": "uptime" + }, + { + "key": "│ │\u001b[11D\u001b[34m󰟾 distro", + "type": "os" + }, + { + "key": "│ │\u001b[11D\u001b[35m kernel", + "type": "kernel" + }, + { + "key": "│ │\u001b[11D\u001b[36m󰇄 desktop", + "type": "de" + }, + { + "key": "│ │\u001b[11D\u001b[31m term", + "type": "terminal" + }, + { + "key": "│ │\u001b[11D\u001b[32m shell", + "type": "shell" + }, + { + "key": "│ │\u001b[11D\u001b[33m󰍛 cpu", + "type": "cpu" + }, + { + "key": "│ │\u001b[11D\u001b[34m󰉉 disk", + "type": "disk", + "folders": "/" + }, + { + "key": "│ │\u001b[11D\u001b[35m memory", + "type": "memory" + }, + { + "key": "│ │\u001b[11D\u001b[36m󰩟 network", + "type": "localip", + "format": "{1} ({4})" + }, + { + "key": "├───────────┤", + "type": "custom" + }, + { + "key": "│ │\u001b[11D\u001b[m colors", + "type": "colors", + "symbol": "circle" + }, + { + "key": "╰───────────╯", + "type": "custom" + } + ] +} diff --git a/src/data/help.json b/src/data/help.json index f7cdfb2ec0..356d3f2a37 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -947,7 +947,8 @@ }, { "long": "disk-folders", - "desc": "A colon (semicolon on Windows) separated list of folder paths for the disk output", + "desc": "A colon (semicolon on Windows) separated list of folder paths to be detected", + "remark": "On Windows, a drive latter must be upper cased and end with \"\\\". \"/\" is used as an alias of the system drive. This option overrides other disk-show-* options", "arg": { "type": "path", "default": "Auto detection using mount-points" diff --git a/src/detection/battery/battery_android.c b/src/detection/battery/battery_android.c index 8939625cf0..6a5e807eaf 100644 --- a/src/detection/battery/battery_android.c +++ b/src/detection/battery/battery_android.c @@ -40,6 +40,7 @@ static const char* parseTermuxApi(FFBatteryOptions* options, FFlist* results) ffStrbufInit(&battery->modelName); ffStrbufInit(&battery->status); ffStrbufInit(&battery->technology); + ffStrbufInit(&battery->serial); ffStrbufInit(&battery->manufactureDate); battery->capacity = yyjson_get_num(yyjson_obj_get(root, "percentage")); @@ -77,6 +78,8 @@ static const char* parseDumpsys(FFBatteryOptions* options, FFlist* results) ffStrbufInit(&battery->modelName); ffStrbufInit(&battery->status); ffStrbufInit(&battery->technology); + ffStrbufInit(&battery->serial); + ffStrbufInit(&battery->manufactureDate); if (ffParsePropLines(start, "AC powered: ", &temp) && ffStrbufEqualS(&temp, "true")) ffStrbufAppendS(&battery->status, "AC powered"); diff --git a/src/detection/disk/disk_windows.c b/src/detection/disk/disk_windows.c index 8c0890eb69..3d78892524 100644 --- a/src/detection/disk/disk_windows.c +++ b/src/detection/disk/disk_windows.c @@ -4,7 +4,6 @@ #include #include -#include const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks) { @@ -15,6 +14,14 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks) FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); + // For cross-platform portability; used by `presets/examples/13.jsonc` + if (__builtin_expect(options->folders.length == 1 && options->folders.chars[0] == '/', 0)) + { + wchar_t path[MAX_PATH + 1]; + GetSystemWindowsDirectoryW(path, sizeof(path) / sizeof(*path)); + ffStrbufSetF(&options->folders, "%c:\\", (char) path[0]); + } + for(uint32_t i = 0; i < length; i++) { wchar_t* mountpoint = buf + i; diff --git a/src/detection/displayserver/linux/wayland/zwlr-output.c b/src/detection/displayserver/linux/wayland/zwlr-output.c index dacb52d371..2071bfa52a 100644 --- a/src/detection/displayserver/linux/wayland/zwlr-output.c +++ b/src/detection/displayserver/linux/wayland/zwlr-output.c @@ -6,7 +6,7 @@ static void waylandZwlrTransformListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, int32_t transform) { WaylandDisplay* wldata = (WaylandDisplay*) data; - wldata->transform = transform; + wldata->transform = (enum wl_output_transform) transform; } static void waylandZwlrScaleListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, wl_fixed_t scale) diff --git a/src/detection/packages/packages.h b/src/detection/packages/packages.h index 87c497ce01..d8983242ae 100644 --- a/src/detection/packages/packages.h +++ b/src/detection/packages/packages.h @@ -26,6 +26,7 @@ typedef struct FFPackagesResult uint32_t rpm; uint32_t scoop; uint32_t snap; + uint32_t sorcery; uint32_t winget; uint32_t xbps; diff --git a/src/detection/packages/packages_linux.c b/src/detection/packages/packages_linux.c index aada79a74a..775fb2607e 100644 --- a/src/detection/packages/packages_linux.c +++ b/src/detection/packages/packages_linux.c @@ -433,6 +433,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts, if (!(options->disabled & FF_PACKAGES_FLAG_PALUDIS_BIT)) packageCounts->paludis += countFilesRecursive(baseDir, "/var/db/paludis/repositories", "environment.bz2"); if (!(options->disabled & FF_PACKAGES_FLAG_OPKG_BIT)) packageCounts->opkg += getNumStrings(baseDir, "/usr/lib/opkg/status", "Package:"); // openwrt if (!(options->disabled & FF_PACKAGES_FLAG_AM_BIT)) packageCounts->am = getAM(baseDir); + if (!(options->disabled & FF_PACKAGES_FLAG_SORCERY_BIT)) packageCounts->sorcery += getNumStrings(baseDir, "/var/state/sorcery/packages", ":installed:"); } static void getPackageCountsRegular(FFstrbuf* baseDir, FFPackagesResult* packageCounts, FFPackagesOptions* options) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index a12bb0930b..58c551e20b 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -243,6 +243,7 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid) ffStrEquals(name, "perf") || ffStrEquals(name, "guake-wrapped") || ffStrEquals(name, "time") || + ffStrEquals(name, "hyfetch") || //when hyfetch uses fastfetch as backend ffStrContainsIgnCase(name, "debug") || ffStrContainsIgnCase(name, "not-found") || ffStrEndsWith(name, ".sh") diff --git a/src/detection/terminalshell/terminalshell_windows.c b/src/detection/terminalshell/terminalshell_windows.c index a0d5335840..7edfd0ef14 100644 --- a/src/detection/terminalshell/terminalshell_windows.c +++ b/src/detection/terminalshell/terminalshell_windows.c @@ -104,6 +104,7 @@ static uint32_t getShellInfo(FFShellResult* result, uint32_t pid) ffStrbufIgnCaseEqualS(&result->prettyName, "python") || // python on windows generates shim executables ffStrbufIgnCaseEqualS(&result->prettyName, "fastfetch") || // scoop warps the real binaries with a "shim" exe ffStrbufIgnCaseEqualS(&result->prettyName, "flashfetch") || + ffStrbufIgnCaseEqualS(&result->prettyName, "hyfetch") || // uses fastfetch as backend ffStrbufContainIgnCaseS(&result->prettyName, "debug") || ffStrbufContainIgnCaseS(&result->prettyName, "time") || ffStrbufStartsWithIgnCaseS(&result->prettyName, "ConEmu") // https://github.com/fastfetch-cli/fastfetch/issues/488#issuecomment-1619982014 diff --git a/src/logo/builtin.c b/src/logo/builtin.c index df4c95c6d5..019aa07d28 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -3791,14 +3791,14 @@ static const FFlogo S[] = { FF_COLOR_FG_WHITE, }, }, - // SourceMage + // Source Mage { - .names = {"Source Mage", "source_mage"}, + .names = {"Source Mage", "Source Mage GNU/Linux", "source_mage", "sourcemage"}, .lines = FASTFETCH_DATATEXT_LOGO_SOURCE_MAGE, .colors = { FF_COLOR_FG_WHITE, }, - .colorKeys = FF_COLOR_FG_BLUE, + .colorKeys = FF_COLOR_FG_RED, .colorTitle = FF_COLOR_FG_WHITE, }, // Solaris diff --git a/src/modules/custom/custom.c b/src/modules/custom/custom.c index b68e19bb90..81e5aa4165 100644 --- a/src/modules/custom/custom.c +++ b/src/modules/custom/custom.c @@ -6,12 +6,6 @@ void ffPrintCustom(FFCustomOptions* options) { - if (options->moduleArgs.outputFormat.length == 0) - { - ffPrintError(FF_CUSTOM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "output format must be set for custom module"); - return; - } - ffPrintLogoAndKey(FF_CUSTOM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); ffStrbufWriteTo(&options->moduleArgs.outputFormat, stdout); puts(FASTFETCH_TEXT_MODIFIER_RESET); diff --git a/src/modules/packages/option.h b/src/modules/packages/option.h index 315ff0dc39..66d332d5db 100644 --- a/src/modules/packages/option.h +++ b/src/modules/packages/option.h @@ -27,6 +27,7 @@ typedef enum FFPackagesFlags FF_PACKAGES_FLAG_WINGET_BIT = 1 << 17, FF_PACKAGES_FLAG_XBPS_BIT = 1 << 18, FF_PACKAGES_FLAG_AM_BIT = 1 << 19, + FF_PACKAGES_FLAG_SORCERY_BIT = 1 << 20, } FFPackagesFlags; typedef struct FFPackagesOptions diff --git a/src/modules/packages/packages.c b/src/modules/packages/packages.c index 7f411d0232..52ab6906d4 100644 --- a/src/modules/packages/packages.c +++ b/src/modules/packages/packages.c @@ -4,7 +4,7 @@ #include "modules/packages/packages.h" #include "util/stringUtils.h" -#define FF_PACKAGES_NUM_FORMAT_ARGS 29 +#define FF_PACKAGES_NUM_FORMAT_ARGS 30 void ffPrintPackages(FFPackagesOptions* options) { @@ -65,6 +65,7 @@ void ffPrintPackages(FFPackagesOptions* options) FF_PRINT_PACKAGE(winget) FF_PRINT_PACKAGE(opkg) FF_PRINT_PACKAGE(am) + FF_PRINT_PACKAGE(sorcery) putchar('\n'); } @@ -100,6 +101,7 @@ void ffPrintPackages(FFPackagesOptions* options) {FF_FORMAT_ARG_TYPE_UINT, &counts.winget}, {FF_FORMAT_ARG_TYPE_UINT, &counts.opkg}, {FF_FORMAT_ARG_TYPE_UINT, &counts.am}, + {FF_FORMAT_ARG_TYPE_UINT, &counts.sorcery}, {FF_FORMAT_ARG_TYPE_UINT, &nixAll}, {FF_FORMAT_ARG_TYPE_UINT, &flatpakAll}, {FF_FORMAT_ARG_TYPE_UINT, &brewAll}, @@ -172,6 +174,7 @@ bool ffParsePackagesCommandOptions(FFPackagesOptions* options, const char* key, case 'S': if (false); FF_TEST_PACKAGE_NAME(SCOOP) FF_TEST_PACKAGE_NAME(SNAP) + FF_TEST_PACKAGE_NAME(SORCERY) break; case 'W': if (false); FF_TEST_PACKAGE_NAME(WINGET) @@ -272,6 +275,7 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) case 'S': if (false); FF_TEST_PACKAGE_NAME(SCOOP) FF_TEST_PACKAGE_NAME(SNAP) + FF_TEST_PACKAGE_NAME(SORCERY) break; case 'W': if (false); FF_TEST_PACKAGE_NAME(WINGET) @@ -322,6 +326,7 @@ void ffGeneratePackagesJsonConfig(FFPackagesOptions* options, yyjson_mut_doc* do FF_TEST_PACKAGE_NAME(WINGET) FF_TEST_PACKAGE_NAME(XBPS) FF_TEST_PACKAGE_NAME(AM) + FF_TEST_PACKAGE_NAME(SORCERY) #undef FF_TEST_PACKAGE_NAME } } @@ -368,12 +373,13 @@ void ffGeneratePackagesJsonResult(FF_MAYBE_UNUSED FFPackagesOptions* options, yy FF_APPEND_PACKAGE_COUNT(xbps) FF_APPEND_PACKAGE_COUNT(opkg) FF_APPEND_PACKAGE_COUNT(am) + FF_APPEND_PACKAGE_COUNT(sorcery) yyjson_mut_obj_add_strbuf(doc, obj, "pacmanBranch", &counts.pacmanBranch); } void ffPrintPackagesHelpFormat(void) { - FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (MacPorts), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget), {25} (opkg), {26} (am)", FF_PACKAGES_NUM_FORMAT_ARGS, ((const char* []) { + FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_PACKAGES_MODULE_NAME, "{2} (pacman){?3}[{3}]{?}, {4} (dpkg), {5} (rpm), {6} (emerge), {7} (eopkg), {8} (xbps), {9} (nix-system), {10} (nix-user), {11} (nix-default), {12} (apk), {13} (pkg), {14} (flatpak-system), {15} (flatpack-user), {16} (snap), {17} (brew), {18} (brew-cask), {19} (MacPorts), {20} (scoop), {21} (choco), {22} (pkgtool), {23} (paludis), {24} (winget), {25} (opkg), {26} (am), {27} (sorcery)", FF_PACKAGES_NUM_FORMAT_ARGS, ((const char* []) { "Number of all packages", "Number of pacman packages", "Pacman branch on manjaro", @@ -400,6 +406,7 @@ void ffPrintPackagesHelpFormat(void) "Number of winget packages", "Number of opkg packages", "Number of am packages", + "Number of sorcery packages", "Total number of all nix packages", "Total number of all flatpak packages", "Total number of all brew packages",