This page provides a comprehensive introduction to fastfetch, its architecture, and core capabilities. It covers the fundamental design patterns, main components, and execution model of the application. For detailed information about specific subsystems, refer to:
Fastfetch is a neofetch-like system information tool written primarily in C, with a focus on performance and customizability README.md1-16 It detects and displays hardware and software information about the host system in a visually formatted output.
Key Characteristics:
| Aspect | Description |
|---|---|
| Language | C (mainly) CMakeLists.txt5 As of v2.61.0, it is pure C CHANGELOG.md98 |
| Platforms | Linux, macOS, Windows 8.1+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku, SunOS README.md16 CHANGELOG.md94-95 |
| License | MIT License CMakeLists.txt10 |
| Configuration | JSONC (JSON with comments) README.md106 |
| Output Formats | Human-readable text with ANSI colors, JSON for machine consumption src/fastfetch.c18-50 |
Sources: README.md1-16 CMakeLists.txt1-10 src/fastfetch.c18-50 CHANGELOG.md94-98
The fastfetch application is built around a single global instance structure FFinstance that holds all configuration and state.
Title: "FFinstance Data Structure and Relationships"
The FFinstance structure is defined in src/fastfetch.h34-37 and the global variable instance is declared as extern in src/fastfetch.h38
FFconfig: Holds user-configurable options managed via FFOptionsLogo, FFOptionsDisplay, and FFOptionsGeneral src/fastfetch.h18-22FFstate: Maintains runtime state information, including the detected FFPlatform and terminal properties src/fastfetch.h24-32Sources: src/fastfetch.h18-38
The application follows an initialization, execution, and cleanup lifecycle. In fastfetch.c and flashfetch.c, the process typically involves:
ffInitInstance() sets up the global instance src/flashfetch.c13ffStart() (aliased as part of initialization/setup) prepares the environment, including terminal detection and starting timers src/flashfetch.c23ffLogoPrint() displays the ASCII or image logo src/flashfetch.c26ffPrintCPU, ffPrintGPU) src/flashfetch.c30-124ffFinish() and ffDestroyInstance() restore the terminal state and free resources src/flashfetch.c126-127Sources: src/fastfetch.c1-12 src/flashfetch.c12-129
Fastfetch implements a modular system where each piece of information (CPU, OS, etc.) is handled by a specific module.
Modules are registered in a global array ffModuleInfos src/fastfetch.h39 Each module is described by a FFModuleBaseInfo structure which contains its name and formatting arguments src/fastfetch.c24-46
Title: "Module Registry to Implementation Mapping"
Fastfetch supports over 70 modules including Battery, CPU, Disk, GPU, Memory, OS, Packages, and Shell src/modules/modules.h3-76
Sources: src/fastfetch.h39 src/modules/modules.h3-76 src/fastfetch.c24-46 src/flashfetch.c30-124
Fastfetch achieves cross-platform support by providing platform-specific implementations for a common detection interface. The build system detects the platform and sets appropriate flags CMakeLists.txt26-50
| Platform | Detection Implementation Examples |
|---|---|
| Linux | LINUX flag set in CMake CMakeLists.txt29 Recent improvements include robust default route detection CHANGELOG.md62 |
| macOS | APPLE flag set in CMake CMakeLists.txt48 Supports M5 Mac models CHANGELOG.md109 |
| Windows | WIN32 flag set in CMake CMakeLists.txt48 Rewritten GPU detection with D3DKMT APIs CHANGELOG.md69 |
| BSD | FreeBSD, OpenBSD, NetBSD, DragonFly flags CMakeLists.txt30-41 |
| Solaris | SunOS flag set in CMake CMakeLists.txt43 |
Sources: CMakeLists.txt26-50 CHANGELOG.md62-109
The build process is managed by CMake CMakeLists.txt3 It uses a series of cmake_dependent_option and option flags to enable or disable features based on the target platform and available libraries.
PkgConfig to find dependencies like vulkan, wayland, or dbus CMakeLists.txt59-81ENABLE_EMBEDDED_PCIIDS allow embedding hardware databases directly into the binary CMakeLists.txt105BUILD_FLASHFETCH option controls whether the faster, demonstration variant is built CMakeLists.txt100Sources: CMakeLists.txt1-110
Fastfetch is designed for both visual appeal and programmatic use.
iterm protocol is automatically used on iTerm terminals CHANGELOG.md85{name}, {version}) src/fastfetch.c37-40 Named arguments are preferred over numeric ones for future-proofing CHANGELOG.md58yyjson for integration with other scripts src/fastfetch.c18-50Sources: src/fastfetch.c18-50 README.md106-108 CHANGELOG.md58-85 src/logo/builtin.c5-11