Compare commits

...

61 Commits

Author SHA1 Message Date
Carter Li e0452d9db5 Merge pull request #1784 from fastfetch-cli/dev
Release: v2.45.0
2025-06-05 10:47:05 +08:00
李通洲 d8e74ba84c Release: v2.45.0 2025-06-05 10:13:56 +08:00
Carter Li 04b13096ac Swap (Haiku): detect detailed info 2025-06-04 22:01:16 +08:00
李通洲 64d4035cae Chore (Haiku): don't use hard-coded page size 2025-06-04 21:26:37 +08:00
Carter Li 5e0ba57f53 Disk (BSD): silence compiler warnings 2025-06-05 04:55:12 +08:00
李通洲 d89263c218 Swap (DragonFly): add support 2025-06-04 20:51:21 +08:00
Carter Li 6a42588786 Swap (SunOS): detect detailed info 2025-06-04 19:36:22 +08:00
Carter Li 5883bf359c Swap (OpenBSD): detect detailed info 2025-06-04 19:05:02 +08:00
Carter Li 6a6b4070ca Swap (Linux): add fallback for Android 2025-06-04 18:35:53 +08:00
Carter Li 2c80cd6d29 Swap (Linux): support detailed info 2025-06-04 16:44:10 +08:00
Carter Li fa4b00b027 Swap (FreeBSD): detect detailed info 2025-06-04 15:30:03 +08:00
李通洲 5fdc924b5d Swap (macOS): detect detailed info 2025-06-04 15:07:05 +08:00
李通洲 3d4a117093 Swap: support separated output 2025-06-04 15:02:02 +08:00
李通洲 7ec0c664c5 Swap (Windows): detect detailed info 2025-06-04 15:01:37 +08:00
李通洲 9d2df589b5 Smbios (DragonFly): acquire SMBIOS info from /dev/mem 2025-06-04 14:22:33 +08:00
李通洲 7107d08e92 DE (DragonFly): fix build 2025-06-04 14:22:33 +08:00
Carter Li 4c34f99c12 Swap (Linux): use /proc/swaps
Preparing for detailed swap usage
2025-06-04 10:37:07 +08:00
Carter Li d7a8c92b46 CI (Linux): fix musl build 2025-06-04 09:05:04 +08:00
李通洲 bbb29ff766 CI (Linux): add missing deps for musl 2025-06-03 21:15:48 +08:00
amnexya 35235b9557 Logo (Builtin): Update logo for Xenia Linux (#1783)
* Update Xenia Linux logo

* Update builtin.c for xenia colours

* Update src/logo/builtin.c

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-03 21:11:50 +08:00
Carter Li 6b94605804 Disk (BSD): don't ignore sshfs 2025-06-03 18:58:38 +08:00
Carter Li 4b2fa07fdc Packages (Linux): fix dnf package count detection (v2) 2025-06-03 10:53:02 +08:00
Carter Li e203f4eeaf Packages (Linux): fix dnf package count detection
Fix #1777
2025-06-03 09:33:43 +08:00
李通洲 8db70b40e2 CI: add back disabled DFBSD 2025-06-02 22:00:32 +08:00
李通洲 1f967849e5 CMake: fix build of FreeBSD 2025-06-02 19:15:14 +08:00
李通洲 d60b2ddfd4 Disk (Linux): don't ignore sshfs
Fix #1776
2025-06-02 19:09:24 +08:00
李通洲 fb68d8a841 CI (Haiku): add build
Disabled due to https://github.com/cross-platform-actions/action/issues/104
2025-06-02 18:48:16 +08:00
李通洲 047411ba87 CMake: build FreeBSD pkg package 2025-06-02 15:56:18 +08:00
李通洲 08ed14b42a Logo: support "type": "command-raw"
Fix #1780
2025-06-02 11:46:43 +08:00
李通洲 d94a41cc1b Chore: tidy 2025-06-02 11:46:43 +08:00
Anshnk 81b7fb06c1 Fix typo, 15,2 isn't a real mac model number 2025-06-02 11:02:10 +08:00
李通洲 c8debccd16 DE (FreeBSD): support KDE version detection 2025-06-02 10:19:36 +08:00
Carter Li 2853bd15c0 Logo (Builtin): add void2
Ported from hyfetch
2025-05-31 23:28:16 +08:00
Carter Li 2f4146fde8 Logo (Builtin): update default colors of voidlinux
Fix  #1775
2025-05-31 23:18:43 +08:00
李通洲 eeceade14e Logo (Builtin): add rhel_small
Fix #1774
2025-05-31 13:39:40 +08:00
李通洲 1875c78e96 WM: support I3 version detection 2025-05-31 10:41:38 +08:00
李通洲 f389864e17 WM: support FVWM version detection 2025-05-31 10:16:26 +08:00
李通洲 b9317734b9 WM: support CTWM version detection 2025-05-31 10:02:45 +08:00
李通洲 4df4a1de78 Logo (Builtin): add Starry Linux
Fix #1771
2025-05-30 13:56:52 +08:00
李通洲 0cd8c6ead6 Chore: code cleanup 2025-05-30 10:33:37 +08:00
李通洲 f8479dae94 GPU: add more GPU vendors 2025-05-30 10:33:26 +08:00
李通洲 a7d623fa75 JsonSchema: update <module>Format [ci skip] 2025-05-29 10:13:57 +08:00
李通洲 7a8ffb27bd Packages: split code 2025-05-26 15:12:47 +08:00
Carter Li 73c0347469 Merge remote-tracking branch 'origin/dev' into dev 2025-05-26 15:00:58 +08:00
Carter Li fde5f3bd0f Packaging: update debian stuff [ci skip] 2025-05-26 15:00:06 +08:00
李通洲 9e1b1302fb Host (Android): add detection for OnePlus market name
Fix #1768
2025-05-26 14:22:47 +08:00
Carter Li 7e235b6be0 Merge pull request #1766 from fastfetch-cli/dev
Release: v2.44.0
2025-05-23 16:10:12 +08:00
李通洲 f43e1fd614 Release: v2.44.0 2025-05-23 15:41:22 +08:00
Carter Li c7b061eebd DisplayServer (Linux): fix errors on KDE beta
Fix #1765
2025-05-22 09:41:35 +08:00
Carter Li a0f579072f Disk: add --disk-hide-fs
Fix #1762
2025-05-21 16:40:42 +08:00
Carter Li d439ce8eb5 Disk: rename hiddenFolder to hideFolder; add docs 2025-05-21 15:09:19 +08:00
Carter Li e2a714732a Disk: add hiddenFolders (2) 2025-05-21 15:00:42 +08:00
asmeron a993a6f126 Logo (Builtin): Add UBLinux Logo (#1764)
* Logo (Builtin): Add UBLinux Logo

* Update builtin.c

---------

Co-authored-by: asmeron <asmeron@ublinux.com>
Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
2025-05-20 21:50:34 -05:00
李通洲 8eb8f710d0 Disk: add option --disk-hidden-folders 2025-05-19 18:32:56 +08:00
李通洲 526868e355 Disk (Linux): don't hard code hidden mount points 2025-05-19 15:25:06 +08:00
李通洲 768238cb46 TerminalShell (Linux): ignore script
Fix #1761
2025-05-17 18:04:41 +08:00
Xavier Xiong 2d938042d0 Logo (Builtin): Add Kylin Logo (Remove ANSI codes) (#1760)
* Logo (Builtin): Add Kylin Logo

* Remove all ANSI escape codes from ASCII Logo

* Add color prefix to kylin logo
2025-05-16 01:05:42 -05:00
李通洲 9a54d92e9f Stat: use ESC 7/8 instead of CSI s/u
Fix Apple Terminal compatibility #1755
2025-05-16 10:33:58 +08:00
Collin 839abab744 Doc: Add information of where to find example config files (#1759) [ci skip] 2025-05-15 19:58:36 -05:00
Md. Iftakhar Awal Chowdhury c054570308 fish complete: add --logo-color-[1-9] completion (#1754)
* fish complete: add `--logo-color-[1-9]` completion

* reverted unnecessary changes
2025-05-15 03:18:19 -05:00
Carter Li ed69a7059b Packaging: update debian stuff [ci skip] 2025-05-14 09:51:44 +08:00
61 changed files with 1096 additions and 158 deletions
+75 -1
View File
@@ -383,7 +383,7 @@ jobs:
run: |
cat /etc/alpine-release
uname -a
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev elfutils-dev gcc g++
apk add cmake samurai vulkan-loader-dev libxcb-dev libxrandr-dev rpm-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev elfutils-dev gcc g++
shell: alpine.sh --root {0}
- name: build
@@ -597,6 +597,80 @@ jobs:
name: fastfetch-netbsd-amd64
path: ./fastfetch-*.*
dragonfly-amd64:
name: DragonFly-amd64
runs-on: ubuntu-latest
if: false
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: vmactions/dragonflybsd-vm@v1
with:
usesh: yes
prepare: |
uname -a
pkg update
pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf egl opencl ocl-icd v4l_compat chafa libelf
run: |
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-dragonfly-amd64
path: ./fastfetch-*.*
haiku-amd64:
name: Haiku-amd64
runs-on: ubuntu-latest
if: false
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4
- name: run VM
uses: cross-platform-actions/action@master
with:
operating_system: haiku
architecture: x86-64
cpu_count: 4
shell: bash
version: 'r1beta5'
run: |
uname -a
ls -l
pkgman install -y git dbus_devel mesa_devel libelf_devel imagemagick_devel opencl_headers ocl_icd_devel vulkan_devel zlib_devel chafa_devel cmake gcc make pkgconfig python3.10
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch -c presets/ci.jsonc --stat false
time ./fastfetch -c presets/ci.jsonc --format json
time ./flashfetch
ldd fastfetch
ctest --output-on-failure
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-haiku-amd64
path: ./fastfetch-*.*
windows-amd64:
name: Windows-amd64
runs-on: windows-latest
+41
View File
@@ -1,3 +1,44 @@
# 2.45.0
Features:
* Support OnePlus marketing name detection (#1768, Host, Android)
* Recognize additional GPU vendors (GPU, Linux)
* Support CTWM, FVWM and I3 window manager version detection (WM)
* Support KDE version detection on *BSD (DE, FreeBSD)
* Support `"logo": { "type": "command-raw" }` to run a command and display its output as logo (#1780, Logo)
* Useful for displaying custom logos generated by other programs such as `pokeget`: `{ "type": "command-raw", "source": "pokeget random --hide-name" }`
* Supported in JSONC config file only. `pokeget random --hide-name | fastfetch --file-raw -` should be used in shell.
* Acquire SMBIOS information on DragonFly BSD from `/dev/mem`; legacy BIOS only (PhysicalMemory, DragonFly)
* Support swap usage detection on DragonFly BSD (Swap, DragonFly)
* Support `--swap-separate` to display detailed swap devices on separate lines (Swap)
Bugfixes
* Fix MacBook Air model name (#1779, Host, macOS)
* Don't ignore sshfs mountpoints (#1776, Disk, Linux / FreeBSD)
* Fix dnf package count detection (#1777, Packages, Linux)
Logos:
* Add Starry Linux (#1771)
* Add rhel_small (#1774)
* Update color palette of voidlinux (#1775)
* Add void2
* Update Xenia Linux (#1783)
# 2.44.0
Features:
* Add option `--disk-hide-folders` and `--disk-hide-fs` to hide specific mountpoints and filesystems in Disk module (Disk)
* `--disk-hide-folders` defaults to `/efi:/boot:/boot/efi` on Linux and *BSD. Previously these EFI-related folders were hardcoded to be hidden on Linux.
Bugfixes:
* Fix Apple Terminal compatibility with `--stat` (macOS, #1755)
* Ignore `/usr/bin/script` when detecting shell and terminal (Terminal / Shell, #1761)
* Fix compatibility with KDE Plasma 6.4 which is in beta currently (Display, Linux, #1765)
Logos:
* Add Kylin (#1760)
* Add UBLinux (#1764)
# 2.43.0
Features:
+13 -8
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.43.0
VERSION 2.45.0
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -787,7 +787,7 @@ elseif(NetBSD)
src/detection/netio/netio_bsd.c
src/detection/opengl/opengl_linux.c
src/detection/os/os_nbsd.c
src/detection/packages/packages_obsd.c
src/detection/packages/packages_nbsd.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_nbsd.c
src/detection/gtk_qt/qt.c
@@ -802,7 +802,7 @@ elseif(NetBSD)
src/detection/users/users_linux.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_nbsd.c
src/detection/wm/wm_nosupport.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
@@ -884,7 +884,7 @@ elseif(OpenBSD)
src/detection/users/users_obsd.c
src/detection/wallpaper/wallpaper_linux.c
src/detection/wifi/wifi_obsd.c
src/detection/wm/wm_nosupport.c
src/detection/wm/wm_linux.c
src/detection/de/de_linux.c
src/detection/wmtheme/wmtheme_linux.c
src/detection/camera/camera_linux.c
@@ -1961,12 +1961,17 @@ if(LINUX)
endif()
endif()
find_program(HAVE_RPMBUILD "rpmbuild")
if(HAVE_RPMBUILD)
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
if(NOT IS_MUSL)
find_program(HAVE_RPMBUILD "rpmbuild")
if(HAVE_RPMBUILD)
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
endif()
endif()
elseif(FreeBSD)
set(CPACK_FREEBSD_PACKAGE_LICENSE "MIT")
set(CPACK_GENERATOR "${CPACK_GENERATOR};FREEBSD")
endif()
set(CPACK_SET_DESTDIR ON)
+2
View File
@@ -21,6 +21,8 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for
<img src="screenshots/example3.png" width="48%" align="top" />
<img src="screenshots/example5.png" height="15%" align="top" />
According configuration files for examples are located [here](https://github.com/fastfetch-cli/fastfetch/tree/dev/presets/examples).
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki).
## Installation
+8 -1
View File
@@ -62,11 +62,17 @@ end
echo '
import json, subprocess, sys
def main():
data: dict[str, list[dict]] = json.loads(subprocess.check_output(["fastfetch", "--help-raw"]))
for key in data:
for flag in data[key]:
if flag["long"] == "logo-color-[1-9]":
for i in range(1, 10):
print(f"""complete -c fastfetch -d "{flag["desc"]}" -l "logo-color-{i}" -x -a "(__fastfetch_complete_color)" """)
continue
if flag.get("pseudo", False):
continue
@@ -75,7 +81,7 @@ def main():
command_prefix += f""" -o {flag["short"]}"""
if "arg" in flag:
type: str = flag["arg"]["type"];
type: str = flag["arg"]["type"]
if type == "bool":
print(f"{command_prefix} -x -a \"(__fastfetch_complete_bool)\"")
elif type == "color":
@@ -98,6 +104,7 @@ def main():
else:
print(f"{command_prefix} -f")
if __name__ == "__main__":
try:
main()
+12
View File
@@ -1,3 +1,15 @@
fastfetch (2.44.0) jammy; urgency=medium
* Update to 2.44.0
-- Carter Li <zhangsongcui@live.cn> Mon, 26 May 2025 14:59:01 +0800
fastfetch (2.43.0) jammy; urgency=medium
* Update to 2.43.0
-- Carter Li <zhangsongcui@live.cn> Wed, 14 May 2025 09:49:50 +0800
fastfetch (2.42.0) jammy; urgency=medium
* Update to 2.42.0
+1 -1
View File
@@ -1 +1 @@
fastfetch_2.42.0_source.buildinfo universe/utils optional
fastfetch_2.44.0_source.buildinfo universe/utils optional
+11 -2
View File
@@ -115,7 +115,7 @@
"type": "string"
},
"biosFormat": {
"description": "Output format of the module `Bios`. See Wiki for formatting syntax\n 1. {date}: Bios date\n 2. {release}: Bios release\n 3. {vendor}: Bios vendor\n 4. {version}: Bios version\n 5. {type}: Firmware type",
"description": "Output format of the module `BIOS`. See Wiki for formatting syntax\n 1. {date}: Bios date\n 2. {release}: Bios release\n 3. {vendor}: Bios vendor\n 4. {version}: Bios version\n 5. {type}: Firmware type",
"type": "string"
},
"bluetoothFormat": {
@@ -339,7 +339,7 @@
"type": "string"
},
"titleFormat": {
"description": "Output format of the module `Title`. See Wiki for formatting syntax\n 1. {user-name}: User name\n 2. {host-name}: Host name\n 3. {home-dir}: Home directory\n 4. {exe-path}: Executable path of current process\n 5. {user-shell}: User's default shell\n 6. {user-name-colored}: User name (colored)\n 7. {at-symbol-colored}: @ symbol (colored)\n 8. {host-name-colored}: Host name (colored)",
"description": "Output format of the module `Title`. See Wiki for formatting syntax\n 1. {user-name}: User name\n 2. {host-name}: Host name\n 3. {home-dir}: Home directory\n 4. {exe-path}: Executable path of current process\n 5. {user-shell}: User's default shell\n 6. {user-name-colored}: User name (colored)\n 7. {at-symbol-colored}: @ symbol (colored)\n 8. {host-name-colored}: Host name (colored)\n 9. {full-user-name}: Full user name",
"type": "string"
},
"themeFormat": {
@@ -429,6 +429,7 @@
"file-raw",
"data",
"data-raw",
"command-raw",
"sixel",
"kitty",
"kitty-direct",
@@ -1754,6 +1755,14 @@
"type": "string",
"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"
},
"hideFolders": {
"type": "string",
"description": "A colon (semicolon on Windows) separated list of folder paths to hide from the disk output\nDefault: /efi:/boot:/boot/efi"
},
"hideFS": {
"type": "string",
"description": "A colon separated file systems to hide from the disk output"
},
"showExternal": {
"type": "boolean",
"description": "Set if external volume should be printed",
+1 -1
View File
@@ -134,7 +134,7 @@ void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
int len = snprintf(str, sizeof str, "%.3fms", ms);
if (thres > 0)
snprintf(str, sizeof str, "\e[%sm%.3fms\e[m", (ms <= thres ? FF_COLOR_FG_GREEN : ms <= 2 * thres ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_RED), ms);
printf("\e[s\e[1A\e[9999999C\e[%dD%s\e[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
printf("\e7\e[1A\e[9999999C\e[%dD%s\e8", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
}
}
+1 -1
View File
@@ -224,7 +224,7 @@ static const char* printJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
int len = snprintf(str, sizeof str, "%.3fms", ms);
if (thres > 0)
snprintf(str, sizeof str, "\e[%sm%.3fms\e[m", (ms <= thres ? FF_COLOR_FG_GREEN : ms <= 2 * thres ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_RED), ms);
printf("\e[s\e[1A\e[9999999C\e[%dD%s\e[u", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
printf("\e7\e[1A\e[9999999C\e[%dD%s\e8", len, str); // Save; Up 1; Right 9999999; Left <len>; Print <str>; Load
}
}
+16
View File
@@ -840,6 +840,22 @@
"default": "Auto detection using mount-points"
}
},
{
"long": "disk-hide-folders",
"desc": "A colon (semicolon on Windows) separated list of folder paths to hide from the disk output",
"arg": {
"type": "path",
"default": "/efi:/boot:/boot/efi"
}
},
{
"long": "disk-hide-fs",
"desc": "A colon separated list of file systems to hide from the disk output",
"arg": {
"type": "string",
"default": ""
}
},
{
"long": "disk-show-regular",
"desc": "Specify whether regular volumes should be displayed",
+1 -1
View File
@@ -151,7 +151,7 @@ static const char* detectNCores(FFCPUResult* cpu)
else if (ptr->Relationship == RelationProcessorCore)
++cpu->coresPhysical;
else if (ptr->Relationship == RelationProcessorPackage)
cpu->packages++;
++cpu->packages;
}
return NULL;
+19 -8
View File
@@ -10,18 +10,29 @@
#include "util/stringUtils.h"
#include <ctype.h>
#ifdef __FreeBSD__
#include <paths.h>
#ifndef _PATH_LOCALBASE
#define _PATH_LOCALBASE "/usr/local"
#endif
#elif __OpenBSD__
#define _PATH_LOCALBASE "/usr/local"
#elif __NetBSD__
#define _PATH_LOCALBASE "/usr/pkg"
#endif
static void getKDE(FFstrbuf* result, FFDEOptions* options)
{
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
{"X-KDE-PluginInfo-Version =", result}
});
#ifdef _PATH_LOCALBASE
ffParsePropFile(_PATH_LOCALBASE "/share/wayland-sessions/plasma.desktop", "X-KDE-PluginInfo-Version =", result);
if(result->length == 0)
{
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
{"X-KDE-PluginInfo-Version =", result}
});
}
ffParsePropFile(_PATH_LOCALBASE "/share/xsessions/plasmax11.desktop", "X-KDE-PluginInfo-Version =", result);
#else
ffParsePropFile(FASTFETCH_TARGET_DIR_USR "/share/wayland-sessions/plasma.desktop", "X-KDE-PluginInfo-Version =", result);
if(result->length == 0)
ffParsePropFile(FASTFETCH_TARGET_DIR_USR "/share/xsessions/plasmax11.desktop", "X-KDE-PluginInfo-Version =", result);
#endif
if(result->length == 0)
ffParsePropFileData("xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", result);
if(result->length == 0)
+4 -4
View File
@@ -1,6 +1,6 @@
#include "disk.h"
bool ffDiskMatchMountpoint(FFDiskOptions* options, const char* mountpoint)
bool ffDiskMatchMountpoint(FFstrbuf* folders, const char* mountpoint)
{
#ifdef _WIN32
const char separator = ';';
@@ -11,12 +11,12 @@ bool ffDiskMatchMountpoint(FFDiskOptions* options, const char* mountpoint)
uint32_t mountpointLength = (uint32_t) strlen(mountpoint);
uint32_t startIndex = 0;
while(startIndex < options->folders.length)
while(startIndex < folders->length)
{
uint32_t colonIndex = ffStrbufNextIndexC(&options->folders, startIndex, separator);
uint32_t colonIndex = ffStrbufNextIndexC(folders, startIndex, separator);
uint32_t folderLength = colonIndex - startIndex;
if (folderLength == mountpointLength && memcmp(options->folders.chars + startIndex, mountpoint, mountpointLength) == 0)
if (folderLength == mountpointLength && memcmp(folders->chars + startIndex, mountpoint, mountpointLength) == 0)
return true;
startIndex = colonIndex + 1;
+1 -1
View File
@@ -28,4 +28,4 @@ typedef struct FFDisk
const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks /* list of FFDisk */);
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks);
bool ffDiskMatchMountpoint(FFDiskOptions* options, const char* mountpoint);
bool ffDiskMatchMountpoint(FFstrbuf* folders, const char* mountpoint);
+7 -7
View File
@@ -52,7 +52,7 @@ static const char* detectFsLabel(struct statfs* fs, FFDisk* disk)
return NULL;
}
#else
static const char* detectFsLabel(struct statfs* fs, FFDisk* disk)
static const char* detectFsLabel(FF_MAYBE_UNUSED struct statfs* fs, FF_MAYBE_UNUSED FFDisk* disk)
{
return "Fastfetch was compiled without libgeom support";
}
@@ -145,10 +145,10 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
if(__builtin_expect(options->folders.length > 0, 0))
{
if(!ffDiskMatchMountpoint(options, fs->f_mntonname))
if(!ffDiskMatchMountpoint(&options->folders, fs->f_mntonname))
continue;
}
else if(!ffStrEquals(fs->f_mntonname, "/") && !ffStrStartsWith(fs->f_mntfromname, "/dev/") && !ffStrEquals(fs->f_fstypename, "zfs"))
else if(!ffStrEquals(fs->f_mntonname, "/") && !ffStrStartsWith(fs->f_mntfromname, "/dev/") && !ffStrEquals(fs->f_fstypename, "zfs") && !ffStrEquals(fs->f_fstypename, "fusefs.sshfs"))
continue;
#ifdef __FreeBSD__
@@ -159,13 +159,13 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
FFDisk* disk = ffListAdd(disks);
disk->bytesTotal = (uint64_t)fs->f_blocks * fs->f_bsize;
disk->bytesFree = (uint64_t)fs->f_bfree * fs->f_bsize;
disk->bytesAvailable = (uint64_t)fs->f_bavail * fs->f_bsize;
disk->bytesTotal = (uint64_t)fs->f_blocks * (uint64_t)fs->f_bsize;
disk->bytesFree = (uint64_t)fs->f_bfree * (uint64_t)fs->f_bsize;
disk->bytesAvailable = (uint64_t)fs->f_bavail * (uint64_t)fs->f_bsize;
disk->bytesUsed = 0; // To be filled in ./disk.c
disk->filesTotal = (uint32_t) fs->f_files;
disk->filesUsed = (uint32_t) (fs->f_files - fs->f_ffree);
disk->filesUsed = (uint32_t) fs->f_files - (uint32_t) fs->f_ffree;
ffStrbufInitS(&disk->mountFrom, fs->f_mntfromname);
ffStrbufInitS(&disk->mountpoint, fs->f_mntonname);
+1 -1
View File
@@ -23,7 +23,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
if (__builtin_expect(options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, path.Path()))
if (!ffDiskMatchMountpoint(&options->folders, path.Path()))
continue;
}
+6 -2
View File
@@ -37,6 +37,10 @@ static bool isPhysicalDevice(const struct mntent* device)
if(ffStrEquals(device->mnt_type, "zfs"))
return true;
//sshfs
if(ffStrEquals(device->mnt_type, "fuse.sshfs"))
return true;
//Pseudo filesystems don't have a device in /dev
if(!ffStrStartsWith(device->mnt_fsname, "/dev/"))
return false;
@@ -220,7 +224,7 @@ static bool isRemovable(FFDisk* currentDisk)
static void detectType(const FFlist* disks, FFDisk* currentDisk, struct mntent* device)
{
if(ffStrbufStartsWithS(&currentDisk->mountpoint, "/boot") || ffStrbufStartsWithS(&currentDisk->mountpoint, "/efi"))
if(hasmntopt(device, "x-gvfs-hide") || hasmntopt(device, "hidden"))
currentDisk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
else if(isSubvolume(disks, currentDisk))
currentDisk->type = FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
@@ -281,7 +285,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
if (__builtin_expect(options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, device->mnt_dir))
if (!ffDiskMatchMountpoint(&options->folders, device->mnt_dir))
continue;
}
else if(!isPhysicalDevice(device))
+1 -1
View File
@@ -113,7 +113,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
{
if (__builtin_expect(options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, device.mnt_mountp))
if (!ffDiskMatchMountpoint(&options->folders, device.mnt_mountp))
continue;
}
else if(!isPhysicalDevice(&device))
+1 -1
View File
@@ -47,7 +47,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
if (__builtin_expect((long) options->folders.length, 0))
{
if (!ffDiskMatchMountpoint(options, buffer.chars))
if (!ffDiskMatchMountpoint(&options->folders, buffer.chars))
continue;
}
else if(driveType == DRIVE_NO_ROOT_DIR)
@@ -5,7 +5,7 @@
#include <stdint.h>
#include <stddef.h>
#include <wayland-util.h>
#include <wayland-client.h>
#ifdef __cplusplus
extern "C" {
@@ -214,6 +214,26 @@ enum kde_output_device_v2_capability {
* @since 9
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS = 0x80,
/**
* if this outputdevice supports the built-in color profile
* @since 12
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_BUILT_IN_COLOR = 0x100,
/**
* if this outputdevice supports DDC/CI
* @since 14
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_DDC_CI = 0x200,
/**
* if this outputdevice supports setting max bpc
* @since 15
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_MAX_BITS_PER_COLOR = 0x400,
/**
* if this outputdevice supports EDR
* @since 16
*/
KDE_OUTPUT_DEVICE_V2_CAPABILITY_EDR = 0x800,
};
/**
* @ingroup iface_kde_output_device_v2
@@ -235,6 +255,22 @@ enum kde_output_device_v2_capability {
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_BRIGHTNESS_SINCE_VERSION 9
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_BUILT_IN_COLOR_SINCE_VERSION 12
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_DDC_CI_SINCE_VERSION 14
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_MAX_BITS_PER_COLOR_SINCE_VERSION 15
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_CAPABILITY_EDR_SINCE_VERSION 16
#endif /* KDE_OUTPUT_DEVICE_V2_CAPABILITY_ENUM */
#ifndef KDE_OUTPUT_DEVICE_V2_VRR_POLICY_ENUM
@@ -316,6 +352,18 @@ enum kde_output_device_v2_color_power_tradeoff {
};
#endif /* KDE_OUTPUT_DEVICE_V2_COLOR_POWER_TRADEOFF_ENUM */
#ifndef KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ENUM
#define KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ENUM
/**
* @ingroup iface_kde_output_device_v2
* when the compositor may make use of EDR
*/
enum kde_output_device_v2_edr_policy {
KDE_OUTPUT_DEVICE_V2_EDR_POLICY_NEVER = 0,
KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ALWAYS = 1,
};
#endif /* KDE_OUTPUT_DEVICE_V2_EDR_POLICY_ENUM */
/**
* @ingroup iface_kde_output_device_v2
* @struct kde_output_device_v2_listener
@@ -658,6 +706,74 @@ struct kde_output_device_v2_listener {
void (*dimming)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t multiplier);
/**
* source output for mirroring
*
*
* @param source uuid of the source output
* @since 13
*/
void (*replication_source)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
const char *source);
/**
* if DDC/CI should be used to control brightness etc.
*
* If the ddc_ci capability is present, this determines if
* settings such as brightness, contrast or others should be set
* using DDC/CI.
* @param allowed 1 if allowed, 0 if disabled
* @since 14
*/
void (*ddc_ci_allowed)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t allowed);
/**
* override max bpc
*
* This limits the amount of bits per color that are sent to the
* display.
* @param max_bpc 0 for the default / automatic
* @since 15
*/
void (*max_bits_per_color)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t max_bpc);
/**
* range of max bits per color value
*
*
* @param min_value the minimum supported by the driver
* @param max_value the maximum supported by the driver
* @since 15
*/
void (*max_bits_per_color_range)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t min_value,
uint32_t max_value);
/**
* if and to what value automatic max bpc is limited
*
*
* @param max_bpc_limit which value automatic bpc gets limited to. 0 if not limited
* @since 15
*/
void (*automatic_max_bits_per_color_limit)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t max_bpc_limit);
/**
* when the compositor may apply EDR
*
* When EDR is enabled, the compositor may increase the backlight
* beyond the user-specified setting, in order to present HDR
* content on displays without native HDR support. This will
* usually result in better visuals, but also increases battery
* usage.
* @since 16
*/
void (*edr_policy)(void *data,
struct kde_output_device_v2 *kde_output_device_v2,
uint32_t policy);
};
/**
@@ -779,6 +895,30 @@ kde_output_device_v2_add_listener(struct kde_output_device_v2 *kde_output_device
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_DIMMING_SINCE_VERSION 11
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_REPLICATION_SOURCE_SINCE_VERSION 13
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_DDC_CI_ALLOWED_SINCE_VERSION 14
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_MAX_BITS_PER_COLOR_SINCE_VERSION 15
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_MAX_BITS_PER_COLOR_RANGE_SINCE_VERSION 15
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_AUTOMATIC_MAX_BITS_PER_COLOR_LIMIT_SINCE_VERSION 15
/**
* @ingroup iface_kde_output_device_v2
*/
#define KDE_OUTPUT_DEVICE_V2_EDR_POLICY_SINCE_VERSION 16
/** @ingroup iface_kde_output_device_v2 */
@@ -60,12 +60,18 @@ static const struct wl_message kde_output_device_v2_events[] = {
{ "brightness", "8u", kde_output_device_v2_types + 0 },
{ "color_power_tradeoff", "10u", kde_output_device_v2_types + 0 },
{ "dimming", "11u", kde_output_device_v2_types + 0 },
{ "replication_source", "13s", kde_output_device_v2_types + 0 },
{ "ddc_ci_allowed", "14u", kde_output_device_v2_types + 0 },
{ "max_bits_per_color", "15u", kde_output_device_v2_types + 0 },
{ "max_bits_per_color_range", "15uu", kde_output_device_v2_types + 0 },
{ "automatic_max_bits_per_color_limit", "15u", kde_output_device_v2_types + 0 },
{ "edr_policy", "16u", kde_output_device_v2_types + 0 },
};
WL_EXPORT const struct wl_interface kde_output_device_v2_interface = {
"kde_output_device_v2", 11,
"kde_output_device_v2", 16,
0, NULL,
27, kde_output_device_v2_events,
33, kde_output_device_v2_events,
};
static const struct wl_message kde_output_device_mode_v2_events[] = {
@@ -137,6 +137,12 @@ static void waylandKdeHdrListener(void *data, FF_MAYBE_UNUSED struct kde_output_
display->hdrEnabled = !!hdr_enabled;
}
static void waylandKdeMaxBitsPerColorListener(void *data, FF_MAYBE_UNUSED struct kde_output_device_v2 *kde_output_device_v2, uint32_t max_bpc)
{
WaylandDisplay* display = data;
display->bitDepth = (uint8_t) max_bpc;
}
static struct kde_output_device_v2_listener outputListener = {
.geometry = waylandKdeGeometryListener,
.current_mode = waylandKdeCurrentModeListener,
@@ -165,6 +171,12 @@ static struct kde_output_device_v2_listener outputListener = {
.brightness = (void*) stubListener,
.color_power_tradeoff = (void*) stubListener,
.dimming = (void*) stubListener,
.replication_source = (void*) stubListener,
.ddc_ci_allowed = (void*) stubListener,
.max_bits_per_color = (void*) waylandKdeMaxBitsPerColorListener,
.max_bits_per_color_range = (void*) stubListener,
.automatic_max_bits_per_color_limit = (void*) stubListener,
.edr_policy = (void*) stubListener,
};
const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
@@ -237,6 +249,7 @@ const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* re
item->manufactureYear = display.myear;
item->manufactureWeek = display.mweek;
item->serial = display.serial;
item->bitDepth = display.bitDepth;
}
ffStrbufDestroy(&display.description);
@@ -34,6 +34,7 @@ typedef struct WaylandData
typedef struct WaylandDisplay
{
WaylandData* parent;
void* internal;
int32_t width;
int32_t height;
int32_t refreshRate;
@@ -55,7 +56,7 @@ typedef struct WaylandDisplay
uint16_t myear;
uint16_t mweek;
uint32_t serial;
void* internal;
uint8_t bitDepth;
} WaylandDisplay;
inline static void stubListener(void* data, ...)
+12 -2
View File
@@ -15,6 +15,11 @@ const char* FF_GPU_VENDOR_NAME_PARALLEL = "Parallel";
const char* FF_GPU_VENDOR_NAME_MICROSOFT = "Microsoft";
const char* FF_GPU_VENDOR_NAME_REDHAT = "RedHat";
const char* FF_GPU_VENDOR_NAME_ORACLE = "Oracle";
const char* FF_GPU_VENDOR_NAME_BROADCOM = "Broadcom";
const char* FF_GPU_VENDOR_NAME_LOONGSON = "Loongson";
const char* FF_GPU_VENDOR_NAME_JINGJIA_MICRO = "Jingjia Micro";
const char* FF_GPU_VENDOR_NAME_HUAWEI = "Huawei";
const char* FF_GPU_VENDOR_NAME_ZHAOXIN = "Zhaoxin";
const char* ffGPUGetVendorString(unsigned vendorId)
{
@@ -22,17 +27,22 @@ const char* ffGPUGetVendorString(unsigned vendorId)
switch (vendorId)
{
case 0x106b: return FF_GPU_VENDOR_NAME_APPLE;
case 0x1002: case 0x1022: return FF_GPU_VENDOR_NAME_AMD;
case 0x1002: case 0x1022: case 0x1dd8: return FF_GPU_VENDOR_NAME_AMD;
case 0x8086: case 0x8087: case 0x03e7: return FF_GPU_VENDOR_NAME_INTEL;
case 0x0955: case 0x10de: case 0x12d2: return FF_GPU_VENDOR_NAME_NVIDIA;
case 0x1ed5: return FF_GPU_VENDOR_NAME_MTHREADS;
case 0x5143: return FF_GPU_VENDOR_NAME_QUALCOMM;
case 0x17cb: case 0x5143: return FF_GPU_VENDOR_NAME_QUALCOMM;
case 0x14c3: return FF_GPU_VENDOR_NAME_MTK;
case 0x15ad: return FF_GPU_VENDOR_NAME_VMWARE;
case 0x1af4: return FF_GPU_VENDOR_NAME_REDHAT;
case 0x1ab8: return FF_GPU_VENDOR_NAME_PARALLEL;
case 0x1414: return FF_GPU_VENDOR_NAME_MICROSOFT;
case 0x108e: return FF_GPU_VENDOR_NAME_ORACLE;
case 0x182f: case 0x14e4: return FF_GPU_VENDOR_NAME_BROADCOM;
case 0x0014: return FF_GPU_VENDOR_NAME_LOONGSON;
case 0x0731: return FF_GPU_VENDOR_NAME_JINGJIA_MICRO;
case 0x19e5: return FF_GPU_VENDOR_NAME_HUAWEI;
case 0x1d17: return FF_GPU_VENDOR_NAME_ZHAOXIN;
default: return NULL;
}
}
-3
View File
@@ -351,10 +351,7 @@ static const char* drmDetectIntelSpecific(FFGPUResult* gpu, const char* drmKey,
{
{
struct drm_xe_device_query query = {
.extensions = 0,
.query = DRM_XE_DEVICE_QUERY_GT_TOPOLOGY,
.size = 0,
.data = 0,
};
if (ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query) >= 0)
{
+1
View File
@@ -12,6 +12,7 @@ const char* ffDetectHost(FFHostResult* host)
|| ffSettingsGetAndroidProperty("ro.vivo.market.name", &host->name)
|| ffSettingsGetAndroidProperty("ro.product.oppo_model", &host->name)
|| ffSettingsGetAndroidProperty("ro.oppo.market.name", &host->name)
|| ffSettingsGetAndroidProperty("ro.vendor.oplus.market.enname", &host->name)
|| ffSettingsGetAndroidProperty("ro.config.devicename", &host->name)
|| ffSettingsGetAndroidProperty("ro.config.marketing_name", &host->name)
|| ffSettingsGetAndroidProperty("ro.product.vendor.model", &host->name)
+1 -1
View File
@@ -121,7 +121,7 @@ const char* ffHostGetMacProductNameWithHwModel(const FFstrbuf* hwModel)
ffStrEquals(version, "16,5")) return "MacBook Pro (16-inch, 2024, Three Thunderbolt 5 ports)";
if(ffStrEquals(version, "15,14")) return "Mac Studio (M3 Ultra, 2025)";
if(ffStrEquals(version, "15,13")) return "MacBook Air (15-inch, M3, 2024)";
if(ffStrEquals(version, "15,2")) return "MacBook Air (13-inch, M3, 2024)";
if(ffStrEquals(version, "15,12")) return "MacBook Air (13-inch, M3, 2024)";
if(ffStrEquals(version, "15,3")) return "MacBook Pro (14-inch, Nov 2023, Two Thunderbolt / USB 4 ports)";
if(ffStrEquals(version, "15,4")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports)";
if(ffStrEquals(version, "15,5")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
+3 -2
View File
@@ -8,8 +8,9 @@ const char* ffDetectMemory(FFMemoryResult* ram)
if (get_system_info(&info) != B_OK)
return "Error getting system info";
ram->bytesTotal = B_PAGE_SIZE * info.max_pages;
ram->bytesUsed = B_PAGE_SIZE * info.used_pages;
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
ram->bytesTotal = pageSize * info.max_pages;
ram->bytesUsed = pageSize * info.used_pages;
return NULL;
}
+5 -1
View File
@@ -554,7 +554,11 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
if (!(options->disabled & FF_PACKAGES_FLAG_PACMAN_BIT)) packageCounts->pacman += getNumElements(baseDir, "/var/lib/pacman/local", true);
if (!(options->disabled & FF_PACKAGES_FLAG_LPKGBUILD_BIT)) packageCounts->lpkgbuild += getNumElements(baseDir, "/opt/Loc-OS-LPKG/lpkgbuild/remove", false);
if (!(options->disabled & FF_PACKAGES_FLAG_PKGTOOL_BIT)) packageCounts->pkgtool += getNumElements(baseDir, "/var/log/packages", false);
if (!(options->disabled & FF_PACKAGES_FLAG_RPM_BIT)) packageCounts->rpm += getSQLite3Int(baseDir, "/var/lib/rpm/rpmdb.sqlite", "SELECT count(*) FROM Packages", "rpm");
if (!(options->disabled & FF_PACKAGES_FLAG_RPM_BIT))
{
// `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)) packageCounts->snap += getSnap(baseDir);
if (!(options->disabled & FF_PACKAGES_FLAG_XBPS_BIT)) packageCounts->xbps += getXBPS(baseDir, "/var/db/xbps");
if (!(options->disabled & FF_PACKAGES_FLAG_BREW_BIT))
+9
View File
@@ -0,0 +1,9 @@
#include "packages.h"
#include "common/io/io.h"
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
{
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT))
result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/usr/pkg/pkgdb", true);
}
-5
View File
@@ -4,11 +4,6 @@
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
{
#if __OpenBSD__
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT))
result->pkg = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/var/db/pkg", true);
#elif __NetBSD__
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT))
result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/usr/pkg/pkgdb", true);
#endif
}
+2 -1
View File
@@ -4,8 +4,9 @@
typedef struct FFSwapResult
{
FFstrbuf name;
uint64_t bytesUsed;
uint64_t bytesTotal;
} FFSwapResult;
const char* ffDetectSwap(FFSwapResult* swap);
const char* ffDetectSwap(FFlist* result /* List of FFSwapResult */);
+3 -1
View File
@@ -3,13 +3,15 @@
#include <mach/mach.h>
#include <sys/sysctl.h>
const char* ffDetectSwap(FFSwapResult* swap)
const char* ffDetectSwap(FFlist* result)
{
struct xsw_usage xsw;
size_t size = sizeof(xsw);
if(sysctl((int[]){ CTL_VM, VM_SWAPUSAGE }, 2, &xsw, &size, NULL, 0) != 0)
return "Failed to read vm.swapusage";
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitStatic(&swap->name, xsw.xsu_encrypted ? "Encrypted" : "Normal");
swap->bytesTotal = xsw.xsu_total;
swap->bytesUsed = xsw.xsu_used;
return NULL;
+48 -7
View File
@@ -2,15 +2,57 @@
#include "common/sysctl.h"
#include <vm/vm_param.h>
#include <sys/stat.h>
#include <sys/param.h>
const char* ffDetectSwap(FFSwapResult* swap)
static void addSwapEntry(FFlist* result, struct xswdev* xsw, uint32_t pageSize)
{
if (xsw->xsw_nblks == 0) // DFBSD reports some /dev/wdog devices with nblks == 0
return;
FFSwapResult* swap = ffListAdd(result);
if (xsw->xsw_dev == NODEV)
ffStrbufInitStatic(&swap->name, "[NFS]");
else
ffStrbufInitF(&swap->name, "/dev/%s", devname(xsw->xsw_dev, S_IFCHR));
swap->bytesUsed = (uint64_t) xsw->xsw_used * pageSize;
swap->bytesTotal = (uint64_t) xsw->xsw_nblks * pageSize;
}
#if __DragonFly__
const char* ffDetectSwap(FFlist* result)
{
struct xswdev xsws[32];
size_t size = sizeof(xsws);
if (sysctlbyname("vm.swap_info_array", xsws, &size, NULL, 0) < 0)
return "sysctlbyname(\"vm.swap_info_array\") failed";
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
size_t count = size / sizeof(struct xswdev);
if (count == 0)
return NULL;
if (xsws->xsw_version != XSWDEV_VERSION)
return "xswdev version mismatch";
for (uint32_t i = 0; i < count; ++i)
addSwapEntry(result, &xsws[i], pageSize);
return NULL;
}
#elif __FreeBSD__
const char* ffDetectSwap(FFlist* result)
{
int mib[16];
size_t mibsize = ARRAY_SIZE(mib);
if (sysctlnametomib("vm.swap_info", mib, &mibsize) < 0)
return "sysctlnametomib(\"vm.swap_info\") failed";
swap->bytesUsed = swap->bytesTotal = 0;
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
for (int n = 0; ; ++n)
{
@@ -21,12 +63,11 @@ const char* ffDetectSwap(FFSwapResult* swap)
break;
if (xsw.xsw_version != XSWDEV_VERSION)
return "xswdev version mismatch";
swap->bytesUsed += (uint64_t) xsw.xsw_used;
swap->bytesTotal += (uint64_t) xsw.xsw_nblks;
}
swap->bytesUsed *= instance.state.platform.sysinfo.pageSize;
swap->bytesTotal *= instance.state.platform.sysinfo.pageSize;
addSwapEntry(result, &xsw, pageSize);
}
return NULL;
}
#endif
+15 -3
View File
@@ -1,15 +1,27 @@
#include "swap.h"
#include <OS.h>
#include <driver_settings.h>
const char* ffDetectSwap(FFSwapResult* swap)
const char* ffDetectSwap(FFlist* result)
{
system_info info;
if (get_system_info(&info) != B_OK)
return "Error getting system info";
swap->bytesTotal = B_PAGE_SIZE * (uint64_t) info.max_swap_pages;
swap->bytesUsed = B_PAGE_SIZE * (uint64_t) (info.max_swap_pages - info.free_swap_pages);
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitStatic(&swap->name, "System");
void* kvms = load_driver_settings("virtual_memory"); // /boot/home/config/settings/kernel/drivers/virtual_memory
if (kvms)
{
const char* swapAuto = get_driver_parameter(kvms, "swap_auto", NULL, NULL);
if (swapAuto)
ffStrbufSetStatic(&swap->name, swapAuto[0] == 'y' ? "Auto" : "Manual");
unload_driver_settings(kvms);
}
swap->bytesTotal = pageSize * (uint64_t) info.max_swap_pages;
swap->bytesUsed = pageSize * (uint64_t) (info.max_swap_pages - info.free_swap_pages);
return NULL;
}
+53 -1
View File
@@ -5,8 +5,9 @@
#include <inttypes.h>
const char* ffDetectSwap(FFSwapResult* swap)
static const char* detectByProcMeminfo(FFlist* result)
{
// For Android
// Ref: #620
char buf[PROC_FILE_BUFFSIZ];
ssize_t nRead = ffReadFileData("/proc/meminfo", ARRAY_SIZE(buf) - 1, buf);
@@ -23,8 +24,59 @@ const char* ffDetectSwap(FFSwapResult* swap)
if ((token = strstr(buf, "SwapFree:")) != NULL)
swapFree = strtoul(token + strlen("SwapFree:"), NULL, 10);
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitStatic(&swap->name, "Total");
swap->bytesTotal = swapTotal * 1024lu;
swap->bytesUsed = (swapTotal - swapFree) * 1024lu;
return NULL;
}
static const char* detectByProcSwaps(FFlist* result)
{
// Ref: #620
char buf[PROC_FILE_BUFFSIZ];
ssize_t nRead = ffReadFileData("/proc/swaps", ARRAY_SIZE(buf) - 1, buf);
if(nRead <= 0)
return "ffReadFileData(\"/proc/swaps\", ARRAY_SIZE(buf)-1, buf) failed";
buf[nRead] = '\0';
// Skip header
char* line = memchr(buf, '\n', (size_t) nRead);
while(line && *++line)
{
uint64_t total, used;
char name[256];
if(sscanf(line, "%255s %*[^\t]%" SCNu64 "%" SCNu64, name, &total, &used) != 3)
return "Invalid /proc/swaps format found";
uint32_t nameLen = (uint32_t) strnlen(name, sizeof(name));
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitA(&swap->name, nameLen);
for (size_t i = 0; i < nameLen; ++i)
{
if(name[i] == '\\')
{
char octal[4] = { name[i + 1], name[i + 2], name[i + 3], '\0' };
ffStrbufAppendC(&swap->name, (char) strtol(octal, NULL, 8));
i += 3;
}
else
ffStrbufAppendC(&swap->name, name[i]);
}
swap->bytesTotal = total * 1024u;
swap->bytesUsed = used * 1024u;
line = memchr(line, '\n', (size_t) (nRead - (line - buf)));
}
return NULL;
}
const char* ffDetectSwap(FFlist* result)
{
if (detectByProcSwaps(result) == NULL)
return NULL;
return detectByProcMeminfo(result);
}
+6 -6
View File
@@ -1,4 +1,5 @@
#include "swap.h"
#include "util/FFlist.h"
#include "util/mallocHelper.h"
#include <sys/types.h>
@@ -6,7 +7,7 @@
#include <sys/param.h>
#include <unistd.h>
const char* ffDetectSwap(FFSwapResult* swap)
const char* ffDetectSwap(FFlist* result)
{
int nswap = swapctl(SWAP_NSWAP, 0, 0);
if (nswap < 0) return "swapctl(SWAP_NSWAP) failed";
@@ -17,17 +18,16 @@ const char* ffDetectSwap(FFSwapResult* swap)
if (swapctl(SWAP_STATS, swdev, nswap) < 0)
return "swapctl(SWAP_STATS) failed";
uint64_t swapTotal = 0, swapUsed = 0;
for (int i = 0; i < nswap; i++)
{
if (swdev[i].se_flags & SWF_ENABLE)
{
swapUsed += (uint64_t) swdev[i].se_inuse;
swapTotal += (uint64_t) swdev[i].se_nblks;
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitS(&swap->name, swdev[i].se_path);
swap->bytesUsed = (uint64_t) swdev[i].se_inuse * DEV_BSIZE;
swap->bytesTotal = (uint64_t) swdev[i].se_nblks * DEV_BSIZE;
}
}
swap->bytesUsed = swapUsed * DEV_BSIZE;
swap->bytesTotal = swapTotal * DEV_BSIZE;
return NULL;
}
+6 -8
View File
@@ -5,7 +5,7 @@
enum { FFMaxNSwap = 8 };
const char* ffDetectSwap(FFSwapResult* swap)
const char* ffDetectSwap(FFlist* result)
{
char strings[FFMaxNSwap][PATH_MAX];
uint8_t buffer[sizeof(swaptbl_t) + sizeof(swapent_t) * (FFMaxNSwap - 1)] = {};
@@ -18,16 +18,14 @@ const char* ffDetectSwap(FFSwapResult* swap)
if (size < 0)
return "swapctl() failed";
swap->bytesTotal = swap->bytesUsed = 0;
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
for (int i = 0; i < size; ++i)
{
swap->bytesTotal += (uint64_t) table->swt_ent[i].ste_pages;
swap->bytesUsed += (uint64_t) table->swt_ent[i].ste_free;
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitS(&swap->name, table->swt_ent[i].ste_path);
swap->bytesTotal = (uint64_t) table->swt_ent[i].ste_pages * pageSize;
swap->bytesUsed = swap->bytesTotal - (uint64_t) table->swt_ent[i].ste_free * pageSize;
}
swap->bytesUsed = swap->bytesTotal - swap->bytesUsed;
swap->bytesTotal *= instance.state.platform.sysinfo.pageSize;
swap->bytesUsed *= instance.state.platform.sysinfo.pageSize;
return NULL;
}
+9 -6
View File
@@ -1,11 +1,12 @@
#include "swap.h"
#include "util/mallocHelper.h"
#include "util/windows/unicode.h"
#include <winternl.h>
#include <ntstatus.h>
#include <windows.h>
const char* ffDetectSwap(FFSwapResult* swap)
const char* ffDetectSwap(FFlist* result)
{
uint8_t buffer[4096];
ULONG size = sizeof(buffer);
@@ -13,16 +14,18 @@ const char* ffDetectSwap(FFSwapResult* swap)
if(!NT_SUCCESS(NtQuerySystemInformation(SystemPagefileInformation, pstart, size, &size)))
return "NtQuerySystemInformation(SystemPagefileInformation, size) failed";
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
for (SYSTEM_PAGEFILE_INFORMATION* current = pstart; ; current = (SYSTEM_PAGEFILE_INFORMATION*)((uint8_t*) current + current->NextEntryOffset))
{
swap->bytesUsed += current->TotalUsed;
swap->bytesTotal += current->CurrentSize;
FFSwapResult* swap = ffListAdd(result);
ffStrbufInitNWS(&swap->name, current->FileName.Length / sizeof(wchar_t), current->FileName.Buffer);
if (ffStrbufStartsWithS(&swap->name, "\\??\\"))
ffStrbufSubstrAfter(&swap->name, strlen("\\??\\") - 1);
swap->bytesUsed = current->TotalUsed * pageSize;
swap->bytesTotal = current->CurrentSize * pageSize;
if (current->NextEntryOffset == 0)
break;
}
uint32_t pageSize = instance.state.platform.sysinfo.pageSize;
swap->bytesUsed *= pageSize;
swap->bytesTotal *= pageSize;
return NULL;
}
@@ -55,9 +55,10 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid)
ffStrbufEqualS(&result->processName, "valgrind") ||
ffStrbufEqualS(&result->processName, "fastfetch") || //994
ffStrbufEqualS(&result->processName, "flashfetch") ||
ffStrbufEqualS(&result->processName, "proot") ||
ffStrbufEqualS(&result->processName, "script") ||
ffStrbufContainS(&result->processName, "debug") ||
ffStrbufContainS(&result->processName, "command-not-") ||
ffStrbufEqualS(&result->processName, "proot") ||
ffStrbufEndsWithS(&result->processName, ".sh")
)
{
@@ -107,6 +108,7 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid)
ffStrbufEqualS(&result->processName, "clifm") || // https://github.com/leo-arch/clifm/issues/289
ffStrbufEqualS(&result->processName, "chezmoi") || // #762
ffStrbufEqualS(&result->processName, "proot") ||
ffStrbufEqualS(&result->processName, "script") ||
#ifdef __linux__
ffStrbufStartsWithS(&result->processName, "flatpak-") || // #707
#endif
+98
View File
@@ -128,6 +128,39 @@ static const char* getSway(FFstrbuf* result)
return "Failed to run command `sway --version`";
}
static bool extractI3Version(const char* line, FF_MAYBE_UNUSED uint32_t len, void *userdata)
{
int count = 0;
sscanf(line, "%*d.%*d%n", &count);
if (count == 0) return true;
ffStrbufSetNS((FFstrbuf*) userdata, len, line);
return false;
}
static const char* getI3(FFstrbuf* result)
{
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
const char* error = ffFindExecutableInPath("i3", &path);
if (error) return "Failed to find i3 executable path";
ffBinaryExtractStrings(path.chars, extractI3Version, result, (uint32_t) strlen("0.0"));
if (result->length > 0) return NULL;
if (ffProcessAppendStdOut(result, (char* const[]){
path.chars,
"--version",
NULL
}) == NULL)
{ // i3 version 1.10 C 2009...
ffStrbufSubstrAfterFirstS(result, "version ");
ffStrbufSubstrBeforeFirstC(result, ' ');
return NULL;
}
return "Failed to run command `i3 --version`";
}
static const char* getWslg(FFstrbuf* result)
{
if (!ffAppendFileBuffer("/mnt/wslg/versions.txt", result))
@@ -143,6 +176,62 @@ static const char* getWslg(FFstrbuf* result)
return NULL;
}
static bool extractCtFvWmVersion(const char* line, FF_MAYBE_UNUSED uint32_t len, void *userdata)
{
int count = 0;
sscanf(line, "%*d.%*d.%*d%n", &count);
if (count == 0) return true;
ffStrbufSetNS((FFstrbuf*) userdata, len, line);
return false;
}
static const char* getCtwm(FFstrbuf* result)
{
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
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"));
if (result->length > 0) return NULL;
if (ffProcessAppendStdOut(result, (char* const[]){
path.chars,
"--version",
NULL
}) == NULL)
{ // ctwm version 4.0.1\n...
ffStrbufSubstrBeforeFirstC(result, '\n');
ffStrbufSubstrAfterLastC(result, ' ');
return NULL;
}
return "Failed to run command `ctwm --version`";
}
static const char* getFvwm(FFstrbuf* result)
{
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
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"));
if (result->length > 0) return NULL;
if (ffProcessAppendStdOut(result, (char* const[]){
path.chars,
"-version",
NULL
}) == NULL)
{ // [FVWM][main]: fvwm Version 2.2.5\n...
ffStrbufSubstrBeforeFirstC(result, '\n');
ffStrbufSubstrAfterLastC(result, ' ');
return NULL;
}
return "Failed to run command `fvwm -version`";
}
const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE_UNUSED FFWMOptions* options)
{
if (!wmName)
@@ -154,8 +243,17 @@ const char* ffDetectWMVersion(const FFstrbuf* wmName, FFstrbuf* result, FF_MAYBE
if (ffStrbufEqualS(wmName, "sway"))
return getSway(result);
if (ffStrbufEqualS(wmName, "i3"))
return getI3(result);
if (ffStrbufEqualS(wmName, "WSLg"))
return getWslg(result);
if (ffStrbufEqualS(wmName, "ctwm"))
return getCtwm(result);
if (ffStrbufEqualS(wmName, "fvwm"))
return getFvwm(result);
return "Unsupported WM";
}
+22
View File
@@ -0,0 +1,22 @@
$1++
$2* ***
$2*******
$2*******$1++
$2********$1+$3===
$2******$1#$2*$1+$3======
$2*******$1#$2***$1++$3===
$2*********$1+$2**$3===
$1##$2*********$1##$3== $3====$1+
$4%$1##$2****$1++$3==$1+$2****$1# $2***$1+$3=$2**
$1#$2****$1++$3=====$1++$2****$1## $2********
$1####$2*$1+$3=======$1+$2******$3===$1- $2***$1#$2*$1##$2****
$1#$4%$1#$2******$1+$2**$1+$3==$1++$2**$3=======$1+$2*$1+$2*$1#$4%
$4%$1#$2****$1+$2******$3=====$1+$3====$1+++$3==$2**
$1#$2*********$1##$2***$1###$2********$1##$4%
$2***$1##$4%$1#$4%%%%$2*****$1#$2*$1###$2*****$1#$4%
$2*$1#$4%%%$1#$4%%%%%$2**** $4%%$2*******$1#$4%
$1#$4%%%%%% $4%%%$1##$2***$1###$4%%
$2**$1#$4% $4%%%%$1#$4% $2**$1#$2**$1##
$1###$4%% $4%%%%%$1 $4%%%$2***
$4%%%%%% $4%%%%%%%$1 $4%%%%$1#$2*
$4%%%%%% $4%%%%%%$1+$3=
+9
View File
@@ -0,0 +1,9 @@
.M.:MMM
MMMMMMMMMM.
,MMMMMMMMMMM
.MM MMMMMMMMMMM
MMMM MMMMMMMMM
MMMMMM MM
MMMMMMMMM ,MMMM
MMMMMMMMMMMMMMMM:
`MMMMMMMMMMMM
+14
View File
@@ -0,0 +1,14 @@
*/
*,*,*(
,,,,,,,,,,,,,,,,,,,,,,,,
,*,*,*,*,*,*,*,*,*,*,*,*
,,,,,,,,,,,,,,,,,,,,,,,,
*,*,*,*,*,*,*,*,*,*,*,*,*,*,*
*,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,,
,,,,,,,,,,,,,,,,,,,,,,,,,,,*
,*,*,*,*,*,*,*,*,*,*,*,*,*,*
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
(*,*,*,*,*,*,*,*,*,*,*,*,*,
,,,,,,,,,,,,,,,,
&*,*,*#@@*,*,*,
+19
View File
@@ -0,0 +1,19 @@
$1 UUU
$1 UUUUUUUUUUU
$1 UUUUUUUUUUUUUUUUU
$1 UUUUUUUUUUUUUUUUUUUUUUUUU
$1UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU$3#.
$1UU$2BBBBB$1UUUUUU$2BBBBBBBBBBB.$1UUUUUU$3##
$1UU$2BBBBB$1UUUUUU$2BBBBBBBBBBBBB:$1UUUU$3##
$1UU$2BBBBB$1UUUUUU$2BBBBB$1UUUU$2BBBBB$1UUUU$3##
$1UU$2BBBBB$1UUUUUU$2BBBBB$1UUUU$2BBBBB$1UUUU$3##
$1UU$2BBBBB$1UUUUUU$2BBBBBBBBBBBB$1UUUUUU$3##
$1UU$2BBBBB$1UUUUUU$2BBBBB$1UUUU,$2BBBB.$1UUU$3##
$1UUU$2BBBBB$1UUUUU$2BBBBB$1UUUUU$2BBBBB$1UUU$3##
$1UUU$2BBBBB$1UUUUU$2BBBBB$1UUUUU$2BBBBB$1UUU$3##
$1UUU#$2BBBBBBBBBBBBBBBBBBBBBBB$1UUUU$3##
$1UUUUUU$2'BBBBBBBBBBBBBBBB'$1UUUUUUU$3##
$1 UUUUUUUUUUUUUUUUUUUUUUUUU$3##'
$1 UUUUUUUUUUUUUUUUU$3###'
$1 UUUUUUUUUUU$3###'
$1 UUU$3###'
+11
View File
@@ -0,0 +1,11 @@
$1 UUUU
$1 UUUUUUUUUU
$1 $2BBB$1UUUU$2BBBBBB$1UU$3#
$1U$2BBB$1UUUU$2BBB$1UUU$2B$1UU$3#
$1U$2BBB$1UUUU$2BBB$1UUU$2B$1UU$3#
$1U$2BBB$1UUUU$2BBBBBB$1UUU$3#
$1U$2BBB$1UUUU$2BBB$1UUU$2BB$1U$3#
$1UU$2BBB$1UUU$2BBB$1UUU$2BB$1U$3#
$1 UU$2BBBBBBBBBBB$1UU$3#
$1 UUUUUUUUU$3#
$1 UUU$3#
+25
View File
@@ -0,0 +1,25 @@
..........
.::::::::::::::::::..
..:::::::::::::::::::::::::.
'::::::::::::::::::::::::::::.
':::::'' '':::::::::::::.
$3 .. $1' '':::::::::.
$3 .||. $1':::::::::
$3 .|||||. $1'::::::::
$3 .|||||||: $1::::::::
$3 |||||||: $1.::::::::. ::::::::
$2 ######$3||||||' $2##^ v##########v$1::. $2##### #############v
$2 ######$3||||| $2##^ v####$1::::::$2####v$1::$2##### #####$1:::::$2#####
$2 ######$3||$2##^ #####$1::::::$2#####$1::$2##### #####$1:::::$2######
$2 ######^$3|| $2#####$1:::::$2####^$1::$2##### #####$1:::::$2#####^
$2 ##^$3||||| $2^###########^$1:::$2##### ##############^
$3 |||||||: $1'::::::::' .::::::::
$3 '|||||||: $1.::::::::'
$3 '|||||||:. $1'::::::
$3 '||||||||:. $1':::
$3 ':|||||||||. . $1'
$3 '|||||||||||:... ...:||||.
':||||||||||||||||||||||||||.
':|||||||||||||||||||||||''
'':||||||||||||||:''
''''''
+15 -21
View File
@@ -1,21 +1,15 @@
$2 ,c. .c;
$2 .$1KMMMk$2.... ....$1kMMMK$2.
$2 .$1WMMMMMX$2..... .....$1KMMMMMW.
$1 XMMMMMMM0$2..... ....$1OMMMMMMMN
$1 dMMMMMMMMM;$2.... ..... ....,$1MMMMMMMMMd
$1 WMMMMMMMMMl;$3okKKKKKKKKKOo$1;cMMMMMMMMMM
$1 'MMMMMMMNX$2K0$3KKKKKKKKKKKKKKK$20K$1XNMMMMMMM;
$1 oMMMMMMM$2Oxo$3KKKKKKKKKKKKKKKKK$2oxO$1MMMMMMMd
$1 dMMMMMMM$2dxxx$3KKKKKKKKKKKKKKK$2xxxd$1NMMMMMMk
$1 :MMMMX0$2xxxxxx$30KKKKKKKK0KK0$2xxxxxx0$1XMMMMc
$1 MMMO$2xxxxxxxxdx$3kdd$20x0$3ddk$2xdxxxxxxxx$1OMMM
$1 ;$2xxkxddxxxxdodxxxxdxdxxxxdodxxxxddxkxx$1;
$1dxd$2KMMMWXo$1'.....'$2cdxxxdc$1'.....'$2lXWMMMX$1dxd
$1cxd$2XMMMN$1,..........$2dxd$1'.........'$2XMMMN$1dxl
$1 .xx$2WMMl$1...''....'.;k:.'....''...$2lMMW$1xx.
$1..:kXMMx..'....''..kMk..''....'..xMMXkc..
$1 dMMMMMMd.....'...xMMMx...''....dMMMMMMx
$1 kMMMMWOoc:coOkolllokOoc:coOWMMMMO
$1 .MMMMMMMMl$2...$1lNMMMMMMM.
$1 KMMMMMMX$2l$1KMMMMMMX
$1 .MMMMMMMMM.
$1 **
* ** */
$2@$1///// / *** *** **** ***/
//////////////**** ** * ** *** **/
,, ,,//////////* ****** ** ** ** /
, , ,,, /////******* ********* /
, ,,,,, ** ** ***********
., ,,,**** ******* *** ///
,, *********** ** ////
,,,,, ******* //// //
,,,,,,. ///// //
,,, , ///////
,,,, /////
,, / /
/
+85 -17
View File
@@ -2516,6 +2516,19 @@ static const FFlogo K[] = {
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_BLUE,
},
// Kylin
{
.names = {"Kylin", "kylin"},
.lines = FASTFETCH_DATATEXT_LOGO_KYLIN,
.colors = {
FF_COLOR_FG_BLUE,
FF_COLOR_FG_CYAN,
FF_COLOR_FG_WHITE,
FF_COLOR_FG_LIGHT_BLACK
},
.colorKeys = FF_COLOR_FG_BLUE,
.colorTitle = FF_COLOR_FG_BLUE,
},
// LAST
{},
};
@@ -4047,7 +4060,7 @@ static const FFlogo R[] = {
},
// RedHatEnterpriseLinux
{
.names = {"rhel", "redhat", "redhat-linux"},
.names = {"rhel", "redhat"},
.lines = FASTFETCH_DATATEXT_LOGO_RHEL,
.colors = {
FF_COLOR_FG_RED,
@@ -4055,9 +4068,20 @@ static const FFlogo R[] = {
.colorKeys = FF_COLOR_FG_RED,
.colorTitle = FF_COLOR_FG_RED,
},
// RedHatEnterpriseLinux
{
.names = {"rhel_small", "redhat_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_RHEL_SMALL,
.colors = {
FF_COLOR_FG_RED,
},
.colorKeys = FF_COLOR_FG_RED,
.colorTitle = FF_COLOR_FG_RED,
},
// RedHatEnterpriseLinux_old
{
.names = {"rhel_old", "redhat_old", "redhat-linux_old"},
.names = {"rhel_old", "redhat_old"},
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_RHEL_OLD,
.colors = {
@@ -4069,11 +4093,10 @@ static const FFlogo R[] = {
{
.names = {"RedOS", "RED OS", "red-os", "redos"},
.lines = FASTFETCH_DATATEXT_LOGO_REDOS,
.colors =
{
FF_COLOR_FG_RED,
FF_COLOR_FG_WHITE,
},
.colors = {
FF_COLOR_FG_RED,
FF_COLOR_FG_WHITE,
},
.colorTitle = FF_COLOR_FG_RED,
.colorKeys = FF_COLOR_FG_RED,
},
@@ -4082,11 +4105,10 @@ static const FFlogo R[] = {
.names = {"RedOS_small", "RED OS_small", "red-os_small", "redos_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_REDOS_SMALL,
.colors =
{
FF_COLOR_FG_RED,
FF_COLOR_FG_WHITE,
},
.colors = {
FF_COLOR_FG_RED,
FF_COLOR_FG_WHITE,
},
.colorTitle = FF_COLOR_FG_RED,
.colorKeys = FF_COLOR_FG_RED,
},
@@ -4514,6 +4536,16 @@ static const FFlogo S[] = {
FF_COLOR_FG_WHITE,
},
},
// Starry
{
.names = {"Starry"},
.lines = FASTFETCH_DATATEXT_LOGO_STARRY,
.colors = {
FF_COLOR_FG_GREEN,
},
.colorKeys = FF_COLOR_FG_GREEN,
.colorTitle = FF_COLOR_FG_WHITE,
},
// StockLinux
{
.names = {"Stock Linux"},
@@ -4722,6 +4754,31 @@ static const FFlogo T[] = {
};
static const FFlogo U[] = {
// UBLinux
{
.names = {"UBLinux"},
.lines = FASTFETCH_DATATEXT_LOGO_UBLINUX,
.colors = {
FF_COLOR_FG_256 "38",
FF_COLOR_FG_WHITE,
FF_COLOR_FG_LIGHT_BLACK,
},
.colorKeys = FF_COLOR_FG_256 "38",
.colorTitle = FF_COLOR_FG_WHITE,
},
// UBLinuxSmall
{
.names = {"UBLinux_small"},
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
.lines = FASTFETCH_DATATEXT_LOGO_UBLINUX_SMALL,
.colors = {
FF_COLOR_FG_256 "38",
FF_COLOR_FG_WHITE,
FF_COLOR_FG_LIGHT_BLACK,
},
.colorKeys = FF_COLOR_FG_256 "38",
.colorTitle = FF_COLOR_FG_WHITE,
},
// Ubuntu
{
.names = {"ubuntu", "ubuntu-linux"},
@@ -5051,9 +5108,9 @@ static const FFlogo V[] = {
.lines = FASTFETCH_DATATEXT_LOGO_VOID,
.colors = {
FF_COLOR_FG_GREEN,
FF_COLOR_FG_BLACK,
FF_COLOR_FG_LIGHT_BLACK,
},
.colorKeys = FF_COLOR_FG_WHITE,
.colorKeys = FF_COLOR_FG_DEFAULT,
.colorTitle = FF_COLOR_FG_GREEN,
},
// VoidSmall
@@ -5064,7 +5121,19 @@ static const FFlogo V[] = {
.colors = {
FF_COLOR_FG_GREEN,
},
.colorKeys = FF_COLOR_FG_WHITE,
.colorKeys = FF_COLOR_FG_DEFAULT,
.colorTitle = FF_COLOR_FG_GREEN,
},
// Void2
{
.names = {"void2"},
.lines = FASTFETCH_DATATEXT_LOGO_VOID2,
.colors = {
FF_COLOR_FG_YELLOW,
FF_COLOR_FG_DEFAULT,
FF_COLOR_FG_GREEN,
},
.colorKeys = FF_COLOR_FG_DEFAULT,
.colorTitle = FF_COLOR_FG_GREEN,
},
// Void2Small
@@ -5192,9 +5261,8 @@ static const FFlogo X[] = {
.names = {"Xenia"},
.lines = FASTFETCH_DATATEXT_LOGO_XENIA,
.colors = {
FF_COLOR_FG_YELLOW,
FF_COLOR_FG_GREEN,
FF_COLOR_FG_RED,
FF_COLOR_FG_WHITE,
}
},
// XCP-ng
+34 -8
View File
@@ -1,6 +1,7 @@
#include "logo/logo.h"
#include "common/io/io.h"
#include "common/printing.h"
#include "common/processing.h"
#include "detection/os/os.h"
#include "detection/terminalshell/terminalshell.h"
#include "util/textModifier.h"
@@ -455,14 +456,13 @@ static inline void logoPrintDetected(FFLogoSize size)
logoPrintStruct(logoGetBuiltinDetected(size));
}
static bool logoPrintData(bool doColorReplacement)
static bool logoPrintData(bool doColorReplacement, FFstrbuf* source)
{
FFOptionsLogo* options = &instance.config.logo;
if(options->source.length == 0)
if(source->length == 0)
return false;
logoApplyColors(logoGetBuiltinDetected(FF_LOGO_SIZE_NORMAL), doColorReplacement);
ffLogoPrintChars(options->source.chars, doColorReplacement);
ffLogoPrintChars(source->chars, doColorReplacement);
return true;
}
@@ -510,7 +510,7 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
)
{
if (instance.config.display.showErrors)
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
fprintf(stderr, "Logo: Failed to load file content from logo source: %s\n", options->source.chars);
return false;
}
@@ -548,10 +548,36 @@ static bool logoTryKnownType(void)
return logoPrintBuiltinIfExists(&options->source, FF_LOGO_SIZE_SMALL);
if(options->type == FF_LOGO_TYPE_DATA)
return logoPrintData(true);
return logoPrintData(true, &options->source);
if(options->type == FF_LOGO_TYPE_DATA_RAW)
return logoPrintData(false);
return logoPrintData(false, &options->source);
if(options->type == FF_LOGO_TYPE_COMMAND_RAW)
{
FF_STRBUF_AUTO_DESTROY source = ffStrbufCreate();
FFCommandOptions* commandOptions = &instance.config.modules.command;
const char* error = ffProcessAppendStdOut(&source, commandOptions->param.length ? (char* const[]){
commandOptions->shell.chars,
commandOptions->param.chars,
options->source.chars,
NULL
} : (char* const[]){
commandOptions->shell.chars,
options->source.chars,
NULL
});
if (error)
{
if (instance.config.display.showErrors)
fprintf(stderr, "Logo: failed to execute command `%s`: %s\n", options->source.chars, error);
return false;
}
return logoPrintData(false, &source);
}
updateLogoPath(); //We sure have a file, resolve relative paths
@@ -603,7 +629,7 @@ void ffLogoPrint(void)
{
// Image logo should have been handled
if(options->type == FF_LOGO_TYPE_BUILTIN || options->type == FF_LOGO_TYPE_SMALL)
fprintf(stderr, "Logo: Failed to load %s logo: %s \n", options->type == FF_LOGO_TYPE_BUILTIN ? "builtin" : "builtin small", options->source.chars);
fprintf(stderr, "Logo: Failed to load %s logo: %s\n", options->type == FF_LOGO_TYPE_BUILTIN ? "builtin" : "builtin small", options->source.chars);
}
logoPrintDetected(FF_LOGO_SIZE_UNKNOWN);
+45
View File
@@ -179,6 +179,12 @@ void ffPrintDisk(FFDiskOptions* options)
if(__builtin_expect(options->folders.length == 0, 1) && (disk->type & ~options->showTypes))
continue;
if (options->hideFolders.length && ffDiskMatchMountpoint(&options->hideFolders, disk->mountpoint.chars))
continue;
if (options->hideFS.length && ffStrbufMatchSeparated(&disk->filesystem, &options->hideFS, ':'))
continue;
printDisk(options, disk, ++index);
}
}
@@ -205,6 +211,18 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
return true;
}
if (ffStrEqualsIgnCase(subKey, "hide-folders"))
{
ffOptionParseString(key, value, &options->hideFolders);
return true;
}
if (ffStrEqualsIgnCase(subKey, "hide-fs"))
{
ffOptionParseString(key, value, &options->hideFS);
return true;
}
if (ffStrEqualsIgnCase(subKey, "show-regular"))
{
if (ffOptionParseBoolean(value))
@@ -293,6 +311,18 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
continue;
}
if (ffStrEqualsIgnCase(key, "hideFolders"))
{
ffStrbufSetS(&options->hideFolders, yyjson_get_str(val));
continue;
}
if (ffStrEqualsIgnCase(key, "hideFS"))
{
ffStrbufSetS(&options->hideFS, yyjson_get_str(val));
continue;
}
if (ffStrEqualsIgnCase(key, "showExternal"))
{
if (yyjson_get_bool(val))
@@ -382,6 +412,12 @@ void ffGenerateDiskJsonConfig(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
if (!ffStrbufEqual(&options->folders, &defaultOptions.folders))
yyjson_mut_obj_add_strbuf(doc, module, "folders", &options->folders);
if (!ffStrbufEqual(&options->hideFolders, &defaultOptions.hideFolders))
yyjson_mut_obj_add_strbuf(doc, module, "hideFolders", &options->hideFolders);
if (!ffStrbufEqual(&options->hideFS, &defaultOptions.hideFS))
yyjson_mut_obj_add_strbuf(doc, module, "hideFS", &options->hideFS);
if (defaultOptions.calcType != options->calcType)
yyjson_mut_obj_add_bool(doc, module, "useAvailable", options->calcType == FF_DISK_CALC_TYPE_AVAILABLE);
@@ -496,6 +532,12 @@ void ffInitDiskOptions(FFDiskOptions* options)
ffOptionInitModuleArg(&options->moduleArgs, "");
ffStrbufInit(&options->folders);
#if _WIN32 || __APPLE__ || __ANDROID__
ffStrbufInit(&options->hideFolders);
#else
ffStrbufInitStatic(&options->hideFolders, "/efi:/boot:/boot/efi");
#endif
ffStrbufInit(&options->hideFS);
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;
options->calcType = FF_DISK_CALC_TYPE_FREE;
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
@@ -504,4 +546,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
void ffDestroyDiskOptions(FFDiskOptions* options)
{
ffOptionDestroyModuleArg(&options->moduleArgs);
ffStrbufDestroy(&options->folders);
ffStrbufDestroy(&options->hideFolders);
ffStrbufDestroy(&options->hideFS);
}
+2
View File
@@ -29,6 +29,8 @@ typedef struct FFDiskOptions
FFModuleArgs moduleArgs;
FFstrbuf folders;
FFstrbuf hideFolders;
FFstrbuf hideFS;
FFDiskVolumeType showTypes;
FFDiskCalcType calcType;
FFPercentageModuleConfig percent;
+1
View File
@@ -11,4 +11,5 @@ typedef struct FFSwapOptions
FFModuleArgs moduleArgs;
FFPercentageModuleConfig percent;
bool separate;
} FFSwapOptions;
+93 -18
View File
@@ -6,34 +6,44 @@
#include "modules/swap/swap.h"
#include "util/stringUtils.h"
void ffPrintSwap(FFSwapOptions* options)
void printSwap(FFSwapOptions* options, uint8_t index, FFSwapResult* storage)
{
FFSwapResult storage = {};
const char* error = ffDetectSwap(&storage);
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
if(error)
if (options->moduleArgs.key.length == 0)
{
ffPrintError(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
return;
if (storage->name.length > 0)
ffStrbufSetF(&key, "%s (%s)", FF_SWAP_MODULE_NAME, storage->name.chars);
else
ffStrbufSetS(&key, FF_SWAP_MODULE_NAME);
}
else
{
ffStrbufClear(&key);
FF_PARSE_FORMAT_STRING_CHECKED(&key, &options->moduleArgs.key, ((FFformatarg[]) {
FF_FORMAT_ARG(index, "index"),
FF_FORMAT_ARG(storage->name, "name"),
FF_FORMAT_ARG(options->moduleArgs.keyIcon, "icon"),
}));
}
FF_STRBUF_AUTO_DESTROY usedPretty = ffStrbufCreate();
ffParseSize(storage.bytesUsed, &usedPretty);
ffParseSize(storage->bytesUsed, &usedPretty);
FF_STRBUF_AUTO_DESTROY totalPretty = ffStrbufCreate();
ffParseSize(storage.bytesTotal, &totalPretty);
ffParseSize(storage->bytesTotal, &totalPretty);
double percentage = storage.bytesTotal == 0
double percentage = storage->bytesTotal == 0
? 0
: (double) storage.bytesUsed / (double) storage.bytesTotal * 100.0;
: (double) storage->bytesUsed / (double) storage->bytesTotal * 100.0;
FFPercentageTypeFlags percentType = options->percent.type == 0 ? instance.config.display.percentType : options->percent.type;
if(options->moduleArgs.outputFormat.length == 0)
{
ffPrintLogoAndKey(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY);
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
if (storage.bytesTotal == 0)
if (storage->bytesTotal == 0)
{
if(percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
{
@@ -71,15 +81,56 @@ void ffPrintSwap(FFSwapOptions* options)
FF_STRBUF_AUTO_DESTROY percentageBar = ffStrbufCreate();
if (percentType & FF_PERCENTAGE_TYPE_BAR_BIT)
ffPercentAppendBar(&percentageBar, percentage, options->percent, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
FF_PRINT_FORMAT_CHECKED(key.chars, index, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]){
FF_FORMAT_ARG(usedPretty, "used"),
FF_FORMAT_ARG(totalPretty, "total"),
FF_FORMAT_ARG(percentageNum, "percentage"),
FF_FORMAT_ARG(percentageBar, "percentage-bar"),
FF_FORMAT_ARG(storage->name, "name"),
}));
}
}
void ffPrintSwap(FFSwapOptions* options)
{
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSwapResult));
const char* error = ffDetectSwap(&result);
if(error)
{
ffPrintError(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
return;
}
if (options->separate)
{
uint8_t index = 0;
FF_LIST_FOR_EACH(FFSwapResult, storage, result)
{
++index;
printSwap(options, index, storage);
}
}
else
{
FFSwapResult total = {
.name = ffStrbufCreate(),
};
FF_LIST_FOR_EACH(FFSwapResult, storage, result)
{
total.bytesUsed += storage->bytesUsed;
total.bytesTotal += storage->bytesTotal;
}
printSwap(options, 0, &total);
ffStrbufDestroy(&total.name);
}
FF_LIST_FOR_EACH(FFSwapResult, storage, result)
{
ffStrbufDestroy(&storage->name);
}
}
bool ffParseSwapCommandOptions(FFSwapOptions* options, const char* key, const char* value)
{
const char* subKey = ffOptionTestPrefix(key, FF_SWAP_MODULE_NAME);
@@ -90,6 +141,12 @@ bool ffParseSwapCommandOptions(FFSwapOptions* options, const char* key, const ch
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
if (ffStrEqualsIgnCase(subKey, "separate"))
{
options->separate = ffOptionParseBoolean(value);
return true;
}
return false;
}
@@ -109,6 +166,12 @@ void ffParseSwapJsonObject(FFSwapOptions* options, yyjson_val* module)
if (ffPercentParseJsonObject(key, val, &options->percent))
continue;
if (ffStrEqualsIgnCase(key, "separate"))
{
options->separate = yyjson_get_bool(val);
continue;
}
ffPrintError(FF_SWAP_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", key);
}
}
@@ -125,8 +188,8 @@ void ffGenerateSwapJsonConfig(FFSwapOptions* options, yyjson_mut_doc* doc, yyjso
void ffGenerateSwapJsonResult(FF_MAYBE_UNUSED FFSwapOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
FFSwapResult storage = {};
const char* error = ffDetectSwap(&storage);
FF_LIST_AUTO_DESTROY result = ffListCreate(sizeof(FFSwapResult));
const char* error = ffDetectSwap(&result);
if(error)
{
@@ -134,9 +197,19 @@ void ffGenerateSwapJsonResult(FF_MAYBE_UNUSED FFSwapOptions* options, yyjson_mut
return;
}
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result");
yyjson_mut_obj_add_uint(doc, obj, "total", storage.bytesTotal);
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
FF_LIST_FOR_EACH(FFSwapResult, storage, result)
{
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
yyjson_mut_obj_add_strbuf(doc, obj, "name", &storage->name);
yyjson_mut_obj_add_uint(doc, obj, "used", storage->bytesUsed);
yyjson_mut_obj_add_uint(doc, obj, "total", storage->bytesTotal);
}
FF_LIST_FOR_EACH(FFSwapResult, storage, result)
{
ffStrbufDestroy(&storage->name);
}
}
static FFModuleBaseInfo ffModuleInfo = {
@@ -152,6 +225,7 @@ static FFModuleBaseInfo ffModuleInfo = {
{"Total size", "total"},
{"Percentage used (num)", "percentage"},
{"Percentage used (bar)", "percentage-bar"},
{"Name", "name"},
}))
};
@@ -160,6 +234,7 @@ void ffInitSwapOptions(FFSwapOptions* options)
options->moduleInfo = ffModuleInfo;
ffOptionInitModuleArg(&options->moduleArgs, "󰓡");
options->percent = (FFPercentageModuleConfig) { 50, 80, 0 };
options->separate = false;
}
void ffDestroySwapOptions(FFSwapOptions* options)
+5
View File
@@ -60,6 +60,7 @@ logoType:
{ "file-raw", FF_LOGO_TYPE_FILE_RAW },
{ "data", FF_LOGO_TYPE_DATA },
{ "data-raw", FF_LOGO_TYPE_DATA_RAW },
{ "command-raw", FF_LOGO_TYPE_COMMAND_RAW },
{ "sixel", FF_LOGO_TYPE_IMAGE_SIXEL },
{ "kitty", FF_LOGO_TYPE_IMAGE_KITTY },
{ "kitty-direct", FF_LOGO_TYPE_IMAGE_KITTY_DIRECT },
@@ -286,6 +287,7 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
{ "file-raw", FF_LOGO_TYPE_FILE_RAW },
{ "data", FF_LOGO_TYPE_DATA },
{ "data-raw", FF_LOGO_TYPE_DATA_RAW },
{ "command-raw", FF_LOGO_TYPE_COMMAND_RAW },
{ "sixel", FF_LOGO_TYPE_IMAGE_SIXEL },
{ "kitty", FF_LOGO_TYPE_IMAGE_KITTY },
{ "kitty-direct", FF_LOGO_TYPE_IMAGE_KITTY_DIRECT },
@@ -492,6 +494,9 @@ void ffOptionsGenerateLogoJsonConfig(FFOptionsLogo* options, yyjson_mut_doc* doc
case FF_LOGO_TYPE_DATA_RAW:
yyjson_mut_obj_add_str(doc, obj, "type", "data-raw");
break;
case FF_LOGO_TYPE_COMMAND_RAW:
yyjson_mut_obj_add_str(doc, obj, "type", "command-raw");
break;
case FF_LOGO_TYPE_IMAGE_SIXEL:
yyjson_mut_obj_add_str(doc, obj, "type", "sixel");
break;
+1
View File
@@ -14,6 +14,7 @@ typedef enum __attribute__((__packed__)) FFLogoType
FF_LOGO_TYPE_FILE_RAW, //text file, printed as is
FF_LOGO_TYPE_DATA, //text data, printed with color code replacement
FF_LOGO_TYPE_DATA_RAW, //text data, printed as is
FF_LOGO_TYPE_COMMAND_RAW, //command to generate text data, printed as is
FF_LOGO_TYPE_IMAGE_SIXEL, //image file, printed as sixel codes
FF_LOGO_TYPE_IMAGE_KITTY, //image file, printed as kitty graphics protocol
FF_LOGO_TYPE_IMAGE_KITTY_DIRECT, //image file, tell the terminal emulator to read image data from the specified file (Supported by kitty and wezterm)
+29
View File
@@ -607,3 +607,32 @@ bool ffStrbufRemoveDupWhitespaces(FFstrbuf* strbuf)
return changed;
}
/// @brief Check if a separated string contains a substring.
/// @param strbuf The substring to check.
/// @param compLength The length of the separated string to check.
/// @param comp The separated string to check.
/// @param separator The separator character.
bool ffStrbufMatchSeparatedNS(const FFstrbuf* strbuf, uint32_t compLength, const char* comp, char separator)
{
if (strbuf->length == 0)
return true;
if (compLength == 0)
return false;
for (const char* p = comp; p < comp + compLength;)
{
const char* colon = memchr(p, separator, compLength);
if (colon == NULL)
return strcmp(strbuf->chars, p) == 0;
uint32_t substrLength = (uint32_t) (colon - p);
if (strbuf->length == substrLength && memcmp(strbuf->chars, p, substrLength) == 0)
return true;
p = colon + 1;
}
return false;
}
+11
View File
@@ -92,6 +92,7 @@ void ffStrbufLowerCase(FFstrbuf* strbuf);
bool ffStrbufGetline(char** lineptr, size_t* n, FFstrbuf* buffer);
void ffStrbufGetlineRestore(char** lineptr, size_t* n, FFstrbuf* buffer);
bool ffStrbufRemoveDupWhitespaces(FFstrbuf* strbuf);
bool ffStrbufMatchSeparatedNS(const FFstrbuf* strbuf, uint32_t compLength, const char* comp, char separator);
FF_C_NODISCARD static inline FFstrbuf ffStrbufCreateA(uint32_t allocate)
{
@@ -506,4 +507,14 @@ static inline void ffStrbufTrim(FFstrbuf* strbuf, char c)
ffStrbufTrimLeft(strbuf, c);
}
static inline bool ffStrbufMatchSeparatedS(const FFstrbuf* strbuf, const char* comp, char separator)
{
return ffStrbufMatchSeparatedNS(strbuf, (uint32_t) strlen(comp), comp, separator);
}
static inline bool ffStrbufMatchSeparated(const FFstrbuf* strbuf, const FFstrbuf* comp, char separator)
{
return ffStrbufMatchSeparatedNS(strbuf, comp->length, comp->chars, separator);
}
#define FF_STRBUF_AUTO_DESTROY FFstrbuf __attribute__((__cleanup__(ffStrbufDestroy)))
+1 -1
View File
@@ -143,7 +143,7 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
{
FF_DEBUG("Initializing SMBIOS buffer");
ffStrbufInit(&buffer);
#if !__HAIKU__ && !__OpenBSD__
#if !__HAIKU__ && !__OpenBSD__ && !__DragonFly__
#ifdef __linux__
FF_DEBUG("Using Linux implementation - trying /sys/firmware/dmi/tables/DMI");
if (!ffAppendFileBuffer("/sys/firmware/dmi/tables/DMI", &buffer))
+14
View File
@@ -635,6 +635,20 @@ int main(void)
VERIFY(ffStrbufEqualS(&newStr, ""));
}
{
ffStrbufSetStatic(&strbuf, "abc");
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "abc:def:ghi", ' ') == false);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "abc:def:ghi", ':') == true);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "def:ghi", ' ') == false);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "def:ghi", ':') == false);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "def", ':') == false);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "abc", ':') == true);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "", ' ') == false);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, ":abc:", ':') == true);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, "abc:", ':') == true);
VERIFY(ffStrbufMatchSeparatedS(&strbuf, ":abc", ':') == true);
}
//Success
puts("\e[32mAll tests passed!" FASTFETCH_TEXT_MODIFIER_RESET);
}