Compare commits

..

57 Commits

Author SHA1 Message Date
李通洲 92588e1159 Fastfetch: fix memory leaks 2023-07-05 10:05:24 +08:00
李通洲 948a480859 Release: v1.12.2 2023-07-05 09:44:44 +08:00
李通洲 ee90d886ab Packages (Linux): print pkgtool package count in custom module format mode 2023-07-05 09:43:52 +08:00
李通洲 f74c643a84 Host (macOS): fix incorrect Host on M2 Mac Studio with M2 Max CPU (#490) 2023-07-05 09:39:16 +08:00
李通洲 03efbe5f6a TerminalShell (Windows): fix #488 2023-07-05 09:39:16 +08:00
李通洲 085479a923 Shell (Windows): fallback shell version detection to file version 2023-07-05 09:39:16 +08:00
李通洲 482b15c62e Packages (Linux): try detecting pkgtool
fix #486
2023-07-05 09:18:00 +08:00
李通洲 1f5da2736e Terminal (Linux): support terminator version detection 2023-07-05 09:12:37 +08:00
李通洲 55234ff1f3 Doc: add CI badge 2023-07-05 09:12:29 +08:00
李通洲 ebbadbed4f Bios (macOS): fix compiling error on Apple Slicon 2023-07-03 15:31:33 +08:00
Linus Dierheimer e7474bda1f Adapt to new repository url 2023-07-02 17:04:46 +08:00
李通洲 fa8bfd08f9 Release: v1.12.0 2023-07-02 13:58:11 +08:00
李通洲 11827d64be TerminalShell: fix compiling on macOS 2023-07-02 13:54:31 +08:00
李通洲 47ac01c8e1 Global: fix compiling 2023-07-02 11:10:12 +08:00
李通洲 23c8937362 fix(Shell): fix shell version printing 2023-07-02 11:04:38 +08:00
李通洲 ad3b7762a3 GPU: fix #484 2023-07-02 11:04:38 +08:00
李通洲 b6c5f49650 GPU (Windows): more strict check 2023-07-02 11:04:38 +08:00
李通洲 5b6416e13c CMake (Windows): remove an unused dependency 2023-07-02 11:04:38 +08:00
李通洲 9d4ec4ca65 Bios (macOS): support bios date detection 2023-07-02 11:04:38 +08:00
李通洲 4652002e8c FFPlatform: fix ffPlatformPathAddEnv on Windows 2023-07-02 11:04:38 +08:00
李通洲 2729d72c68 GPU (macOS): remove an unused #include 2023-07-02 11:04:38 +08:00
Carter Li c18bcd316d GPU (macOS): fix typo 2023-07-02 11:04:38 +08:00
Carter Li 8fd30e814a GPU (macOS): fix vendor detection for Intel GPU 2023-07-02 11:04:38 +08:00
李通洲 b1b637fe2f OS (Windows): code refactor; fix common/library.h usage for C++ 2023-07-02 11:04:38 +08:00
李通洲 86806b64a2 CI (FreeBSD): build with libpulse support 2023-07-02 11:04:38 +08:00
Carter Li 96a8548c59 DisplayServer: dirty hack for #477 2023-07-02 11:04:38 +08:00
Carter Li c7becf82bd DisplayServer (Wayland): warn if some properties of wl_output_listener are not supported 2023-07-02 11:04:38 +08:00
李通洲 2d80085d6e Logo (Windows): make Windows logos colorable 2023-07-02 11:04:38 +08:00
Carter Li e63669bea3 Logo: more BSD logos 2023-07-02 11:04:38 +08:00
Carter Li 9568eb8dd3 TerminalFont (FreeBSD): fix gnome-terminal font detection 2023-07-02 11:04:38 +08:00
Carter Li a63925483c Terminal (Linux): print gnome-terminal-server as gnome-terminal 2023-07-02 11:04:38 +08:00
Carter Li 67689f9229 Terminal (FreeBSD): fix Gnome Terminal version detetion on FreeBSD 2023-07-02 11:04:38 +08:00
李通洲 161f86eb45 DisplayServer (Linux): add fast path of kde version detection for Fedora 2023-07-02 11:04:38 +08:00
李通洲 1994219531 DisplayServer (Linux): mark plasmashell --version as slow operation
It costs more than 1 sec some time
2023-07-02 11:04:38 +08:00
李通洲 2ec0353423 Disk (Android): actually detect something 2023-07-02 10:35:33 +08:00
Carter Li 8088905721 Host (macOS): update newest product name data 2023-07-02 10:34:33 +08:00
Carter Li ec049fd490 Fastfetch: set pipe=true automatically if stdout is not a tty 2023-07-02 10:34:12 +08:00
李通洲 033cced5a9 CMake (Windows): silence compiler warnings 2023-07-02 10:32:25 +08:00
李通洲 a059c55f05 Memory (FreeBSD): count cached memory as free memory
As what neofetch did
2023-07-02 10:30:21 +08:00
李通洲 0b00b5ffe0 FreeBSD (CPU): fix temperature detection 2023-07-02 10:29:16 +08:00
李通洲 6e7a6174ba Disk (Linux): don't detect WSL drives as subvolumes 2023-07-02 10:27:36 +08:00
李通洲 07eddf9772 GPU (Linux): always initialize variables 2023-07-02 10:26:32 +08:00
李通洲 c451a377c9 CMake: make some serious warnings as errors 2023-07-02 10:25:41 +08:00
Linus Dierheimer e5de3a90c6 Remove debug statement 2023-07-02 10:24:40 +08:00
Linus Dierheimer 7aecf385e2 Include limits.h when needed
Fixes #472
2023-07-02 10:24:22 +08:00
李通洲 1de049bdf5 Wallpaper (Linux): support Cinnamon 2023-07-02 10:23:00 +08:00
李通洲 55b8c0947b Wallpaper (Linux): support MATE 2023-07-02 10:22:50 +08:00
李通洲 51ba806e6d TerminalFont (Linux): support MATE Terminal 2023-07-02 10:21:51 +08:00
李通洲 ae2855d123 Terminal (Linux): support MATE terminal version detection 2023-07-02 10:21:39 +08:00
李通洲 9000432b52 Wallpaper (Linux): fix xfce wallpaper detection on my laptop 2023-07-02 10:21:28 +08:00
李通洲 618e5f01df Wallpaper (Linux): support lxqt 2023-07-02 10:21:19 +08:00
李通洲 0486ad8da7 TerminalFont (Linux): support QTerminal 2023-07-02 10:21:00 +08:00
李通洲 d23831465a Terminal: support qterminal version detection 2023-07-02 10:20:24 +08:00
李通洲 6ba95d7017 Wallpaper (Linux): support KDE 2023-07-02 10:20:00 +08:00
李通洲 6acfc1b715 DE: fix KDE version detection on Fedora 2023-07-02 10:18:18 +08:00
李通洲 af2e9a9a78 Logo: fix paddingLeft doesn't work when paddingTop is set 2023-07-02 10:17:12 +08:00
李通洲 af33627c4c DisplayServer: fix typos. 2023-07-02 10:13:46 +08:00
38 changed files with 443 additions and 175 deletions
@@ -1,4 +1,4 @@
name: manage pushes
name: CI
on:
- push
@@ -150,7 +150,7 @@ jobs:
uses: vmactions/freebsd-vm@v0
with:
prepare: |
pkg install -y cmake git pkgconf pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd
pkg install -y cmake git pkgconf pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd pulseaudio
run: |
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
cmake --build . --target package
@@ -285,7 +285,7 @@ jobs:
path: ./fastfetch-*-Win32.zip
release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'LinusDierheimer/fastfetch'
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'fastfetch-cli/fastfetch'
name: Release
runs-on: ubuntu-latest
needs:
+46
View File
@@ -1,3 +1,49 @@
# 1.12.2
Features:
* Support terminator terminal version detection (Linux, Terminal)
* Support `pkgtool` package manager detection (Linux, Packages)
* Support `Far` shell version detection (Windows, Shell)
Bugfixes:
* Fix ConEmu terminal detection in some special cases (Windows, Terminal, #488)
* Fix incorrect Host on M2 Mac Studio with M2 Max CPU (macOS, Host, #490)
# 1.12.1
Bugfixes:
* Fix compiling error on Apple Slicon (Bios, macOS)
# 1.12.0
This release backports some changes from dev branch, and fixes 2 crashing issues
Features:
* Support KDE / LXQT / MATE / Cinnamon wallpaper detection (Wallpaper, Linux)
* Support QTerminal version & terminal font detection
* Support MATE Terminal version & terminal font detection
* Set `--pipe true` automatically if stdout is not a tty
* Detect new macs released on WWDC 2023 (macOS, Host)
* Count cached memory as free memory (FreeBSD, Memory)
* Support sound detection (FreeBSD, Sound)
Bugfixes:
* Fix DE detection on Windows 8.1 (Windows, DE)
* Fix `--logo-padding-left` doesn't work when `--logo-padding-top` is set (Logo)
* Fix KDE version detection on Fedora (DE)
* Include limits.h when needed (Linux, #472)
* Fix Windows drives detection in WSL (Linux, Disk)
* Fix CPU temp detection (FreeBSD, CPU)
* Fix disk detection (Android, Disk)
* Fix Gnome Terminal version and font detection (FreeBSD, TerminalFont)
* Fix crash on newer wayland desktops (Linux, Display, #477)
* Fix vendor detection for Intel GPU (macOS, GPU)
* Fix possible crashes on Windows Server (Windows, GPU, #484)
Logo:
* Add bsd, freebsd_small, ghostbsd
* Make Windows 11 logo colorable
# 1.11.3
Bugfixes:
+6 -5
View File
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
project(fastfetch
VERSION 1.11.3
VERSION 1.12.2
LANGUAGES C
DESCRIPTION "Fast system information tool"
HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
)
set(PROJECT_LICENSE "MIT license")
@@ -96,12 +96,14 @@ else()
message(STATUS "Threads type: disabled")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type")
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration")
if(WIN32)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wconversion -fno-exceptions -fno-rtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -fno-exceptions -fno-rtti")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--tsaware -Wl,--build-id -Wl,--subsystem,console:6.1,--major-os-version,6,--minor-os-version,1")
endif()
@@ -748,7 +750,6 @@ elseif(WIN32)
PRIVATE "setupapi"
PRIVATE "hid"
PRIVATE "wtsapi32"
PRIVATE "powrprof"
)
endif()
+6 -4
View File
@@ -1,5 +1,7 @@
# Fastfetch
[![CI](https://github.com/fastfetch-cli/fastfetch/actions/workflows/ci.yml/badge.svg)](https://github.com/fastfetch-cli/fastfetch/actions/workflows/ci.yml)
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying them in a pretty way. It is written mainly in C, with performance and customizability in mind. Currently, Linux, Android, FreeBSD, MacOS and Windows 7+ are supported.
<img src="screenshots/example1.png" width="49%" align="left" />
@@ -10,7 +12,7 @@ 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" />
There are [screenshots on different platforms](https://github.com/LinusDierheimer/fastfetch/wiki)
There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki)
## Customization
@@ -95,12 +97,12 @@ Battery, Bios, Bluetooth, Board, Break, Brightness, Colors, Command, CPU, CPUUsa
##### Builtin logos
```
AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, Crystal, Debian, Deepin, Devuan, Endeavour, Enso, Fedora, FreeBSD, Garuda, Gentoo, KDE Neon, KISS, Kubuntu, LangitKetujuh, Linux, MacOS, Manjaro, Mint, MSYS2, NixOS, Nobara, OpenSUSE, OpenSUSE LEAP, OpenSUSE Tumbleweed, Parabola, Pop!_OS, Raspbian, RebornOS, RedstarOS, Rocky, Rosa, Slackware, Solus, SteamOS, Ubuntu, Vanilla, Void, Windows, Windows 11, Windows 8, Zorin
AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, Crystal, Debian, Deepin, Devuan, Endeavour, Enso, Fedora, FreeBSD, Garuda, Gentoo, GhostBSD, KDE Neon, KISS, Kubuntu, LangitKetujuh, Linux, MacOS, Manjaro, Mint, MSYS2, NixOS, Nobara, OpenSUSE, OpenSUSE LEAP, OpenSUSE Tumbleweed, Parabola, Pop!_OS, Raspbian, RebornOS, RedstarOS, Rocky, Rosa, Slackware, Solus, SteamOS, Ubuntu, Vanilla, Void, Windows, Windows 11, Windows 8, Zorin
```
##### Package managers
```
apk, brew, Chocolatey, dpkg, emerge, eopkg, Flatpak, MacPorts, nix, Pacman, pkg, rpm, scoop, Snap, xbps
apk, brew, Chocolatey, dpkg, emerge, eopkg, Flatpak, MacPorts, nix, Pacman, pkg, pkgtool, rpm, scoop, Snap, xbps
```
##### WM themes
@@ -115,7 +117,7 @@ Budgie, Cinnamon, Gnome, KDE Plasma, LXQt, Mate, XFCE4
##### Terminal fonts
```
Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, mintty, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal
Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, MATE Terminal, mintty, QTerminal, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal
```
## Building
+1 -1
View File
@@ -3,7 +3,7 @@
--kernel-format Sysname: {}; Release: {}; Version: {}
--uptime-format Days: {}; Hours: {}; Minutes: {}; Seconds: {}
--processes-format Count: {}
--packages-format All: {}; pacman: {}; pacman branch: {}; dpkg: {}; rpm: {}; emerge: {}; eopkg: {}; xbps: {}; apk: {}; flatpak-system: {}; flatpak-user: {}; snap: {}; brew: {}; brew-cask: {}; port: {}; scoop: {}; choco: {}
--packages-format All: {}; pacman: {}; pacman branch: {}; dpkg: {}; rpm: {}; emerge: {}; eopkg: {}; xbps: {}; apk: {}; flatpak-system: {}; flatpak-user: {}; snap: {}; brew: {}; brew-cask: {}; port: {}; scoop: {}; choco: {}; pkgtool: {}
--shell-format Process name: {}; Process path: {}; Process exe: {}; Process version: {}; User path: {}; User exe: {}; User version: {}
--display-format Width: {}; Height: {}; Refresh rate: {}; ScaledWith: {}; ScaledHeight: {}
--de-format Process name: {}; Pretty name: {}; Version: {}
+3 -3
View File
@@ -60,12 +60,12 @@ static void defaultConfig(FFinstance* instance)
instance->config.showErrors = false;
instance->config.recache = false;
instance->config.allowSlowOperations = false;
instance->config.disableLinewrap = true;
instance->config.hideCursor = true;
instance->config.pipe = !isatty(STDOUT_FILENO);
instance->config.disableLinewrap = !instance->config.pipe;
instance->config.hideCursor = !instance->config.pipe;
instance->config.escapeBedrock = true;
instance->config.binaryPrefixType = FF_BINARY_PREFIX_TYPE_IEC;
instance->config.glType = FF_GL_TYPE_AUTO;
instance->config.pipe = false;
instance->config.multithreading = true;
instance->config.stat = false;
+4 -4
View File
@@ -10,7 +10,7 @@
#include <libloaderapi.h>
#define FF_DLOPEN_FLAGS 0
FF_C_NODISCARD static inline void* dlopen(const char* path, int mode) { FF_UNUSED(mode); return LoadLibraryA(path); }
FF_C_NODISCARD static inline void* dlsym(void* handle, const char* symbol) { return GetProcAddress((HMODULE)handle, symbol); }
FF_C_NODISCARD static inline void* dlsym(void* handle, const char* symbol) { return (void*) GetProcAddress((HMODULE)handle, symbol); }
static inline int dlclose(void* handle) { return !FreeLibrary((HMODULE)handle); }
#else
#include <dlfcn.h>
@@ -40,20 +40,20 @@ static inline void ffLibraryUnload(void** handle)
return returnValue;
#define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \
symbolMapping = dlsym(library, #symbolName); \
symbolMapping = (__typeof__(&symbolName)) dlsym(library, #symbolName); \
if(symbolMapping == NULL) \
return returnValue;
#define FF_LIBRARY_LOAD_SYMBOL_ADDRESS2(library, symbolMapping, symbolName, alternateName, returnValue) \
symbolMapping = dlsym(library, #symbolName); \
if(symbolMapping == NULL && !(symbolMapping = dlsym(library, #alternateName))) \
if(symbolMapping == NULL && !(symbolMapping = (__typeof__(&symbolName)) dlsym(library, #alternateName))) \
return returnValue;
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \
__typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, returnValue);
#define FF_LIBRARY_LOAD_SYMBOL_LAZY(library, symbolName) \
__typeof__(&symbolName) ff ## symbolName = dlsym(library, #symbolName);
__typeof__(&symbolName) ff ## symbolName = (__typeof__(&symbolName)) dlsym(library, #symbolName);
#define FF_LIBRARY_LOAD_SYMBOL_MESSAGE(library, symbolName) \
__typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, "dlsym " #symbolName " failed");
+1
View File
@@ -48,6 +48,7 @@ void ffDetectBios(FFBiosResult* bios)
if(IORegistryEntryCreateCFProperties(registryEntry, &properties, kCFAllocatorDefault, kNilOptions) == kIOReturnSuccess)
{
ffCfDictGetString(properties, CFSTR("manufacturer"), &bios->biosVendor);
ffCfDictGetString(properties, CFSTR("time-stamp"), &bios->biosDate);
CFRelease(properties);
}
IOObjectRelease(registryEntry);
@@ -3,6 +3,7 @@
#include <dirent.h>
#include <ctype.h>
#include <limits.h>
const char* ffDetectBrightness(FF_MAYBE_UNUSED FFlist* result)
{
+2 -3
View File
@@ -7,9 +7,8 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu)
if (instance->config.cpuTemp)
{
FFstrbuf cpuTemp;
ffStrbufInit(&cpuTemp);
if(ffSysctlGetString("temperature", &cpuTemp))
FF_STRBUF_AUTO_DESTROY cpuTemp = ffStrbufCreate();
if(ffSysctlGetString("hw.acpi.thermal.tz0.temperature", &cpuTemp))
cpu->temperature = FF_CPU_TEMP_UNSET;
else
cpu->temperature = ffStrbufToDouble(&cpuTemp);
+10 -3
View File
@@ -17,6 +17,8 @@
static bool isPhysicalDevice(FFstrbuf* device)
{
#ifndef __ANDROID__ //On Android, `/dev` is not accessable, so that the following checks always fail
//DrvFs is a filesystem plugin to WSL that was designed to support interop between WSL and the Windows filesystem.
if(ffStrbufEqualS(device, "drvfs"))
return true;
@@ -37,6 +39,8 @@ static bool isPhysicalDevice(FFstrbuf* device)
if(!ffStrbufStartsWithS(device, "/dev/"))
return false;
#endif // __ANDROID__
if(
ffStrbufStartsWithS(device, "/dev/loop") || //Ignore loop devices
ffStrbufStartsWithS(device, "/dev/ram") || //Ignore ram devices
@@ -147,20 +151,23 @@ static void detectType(FF_MAYBE_UNUSED const FFlist* devices, FFDisk* currentDis
static bool isSubvolume(const FFlist* devices)
{
const FFstrbuf* currentDevie = ffListGet(devices, devices->length - 1);
const FFstrbuf* current = ffListGet(devices, devices->length - 1);
if(ffStrbufEqualS(current, "drvfs")) // WSL Windows drives
return false;
//Filter all disks which device was already found. This catches BTRFS subvolumes.
for(uint32_t i = 0; i < devices->length - 1; i++)
{
const FFstrbuf* otherDevice = ffListGet(devices, i);
if(ffStrbufEqual(currentDevie, otherDevice))
if(ffStrbufEqual(current, otherDevice))
return true;
}
//ZFS subvolumes: rpool/<POOL_NAME>/<VOLUME_NAME>/<SUBVOLUME_NAME>.
//Test if the third slash is present.
if(strncmp(currentDevie->chars, "rpool/", 6) == 0 && ffStrHasNChars(currentDevie->chars, '/', 3))
if(ffStrbufStartsWithS(current, "rpool/") && ffStrHasNChars(current->chars, '/', 3))
return true;
return false;
@@ -117,7 +117,6 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
ffStrbufInit(&ds->deProcessName);
ffStrbufInit(&ds->dePrettyName);
ffStrbufInit(&ds->deVersion);
ffStrbufInit(&ds->deProcessName);
ffStrbufAppendS(&ds->dePrettyName, "Aqua");
ffListInitA(&ds->displays, sizeof(FFDisplayResult), 4);
@@ -126,7 +126,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins
) ffStrbufSetS(&ds->dePrettyName, "Fluent");
else if(
ffStrbufEqualS(&os->version, "8") ||
ffStrbufEqualS(&os->version, "81.") ||
ffStrbufEqualS(&os->version, "8.1") ||
ffStrbufEqualS(&os->version, "2012 R2") ||
ffStrbufEqualS(&os->version, "2012")
) ffStrbufSetS(&ds->dePrettyName, "Metro");
+14 -23
View File
@@ -9,6 +9,7 @@
#include "common/thread.h"
#include <wayland-client.h>
#include <sys/socket.h>
#include <assert.h>
typedef struct WaylandData
{
@@ -73,13 +74,11 @@ static void waylandOutputModeListener(void* data, FF_MAYBE_UNUSED struct wl_outp
display->refreshRate = refreshRate;
}
#ifdef WL_OUTPUT_SCALE_SINCE_VERSION
static void waylandOutputScaleListener(void* data, FF_MAYBE_UNUSED struct wl_output* output, int32_t scale)
{
WaylandDisplay* display = data;
display->scale = scale;
}
#endif
static void waylandOutputGeometryListener(void *data,
FF_MAYBE_UNUSED struct wl_output *output,
@@ -107,7 +106,6 @@ static void waylandOutputGeometryListener(void *data,
}
}
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
static void waylandOutputNameListener(void *data, FF_MAYBE_UNUSED struct wl_output *output, const char *name)
{
WaylandDisplay* display = data;
@@ -116,7 +114,6 @@ static void waylandOutputNameListener(void *data, FF_MAYBE_UNUSED struct wl_outp
else if(strncmp(name, "HDMI-", strlen("HDMI-")) == 0 || strncmp(name, "DP-", strlen("DP-")) == 0)
display->type = FF_DISPLAY_TYPE_EXTERNAL;
}
#endif
static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
{
@@ -135,26 +132,20 @@ static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* regist
};
ffStrbufInit(&display.name);
struct wl_output_listener outputListener = {
.mode = waylandOutputModeListener,
.geometry = waylandOutputGeometryListener,
#ifdef WL_OUTPUT_DONE_SINCE_VERSION
.done = (void*) stubListener,
#endif
#ifdef WL_OUTPUT_SCALE_SINCE_VERSION
.scale = waylandOutputScaleListener,
#endif
#ifdef WL_OUTPUT_NAME_SINCE_VERSION
.name = waylandOutputNameListener,
#endif
#ifdef WL_OUTPUT_DESCRIPTION_SINCE_VERSION
.description = (void*) stubListener,
#endif
// Dirty hack for #477
// The order of these callbacks MUST follow `struct wl_output_listener`
void* outputListener[] = {
waylandOutputGeometryListener, // geometry
waylandOutputModeListener, // mode
stubListener, // done
waylandOutputScaleListener, // scale
waylandOutputNameListener, // name
stubListener, // description
};
static_assert(
sizeof(outputListener) >= sizeof(struct wl_output_listener),
"sizeof(outputListener) is too small. Please report it to fastfetch github issue"
);
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, &display);
wldata->ffwl_display_roundtrip(wldata->display);
+22 -1
View File
@@ -125,14 +125,35 @@ static void getKDE(const FFinstance* instance, FFDisplayServerResult* result)
ffStrbufSetS(&result->deProcessName, "plasmashell");
ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_PLASMA);
ffParsePropFileData(instance, "xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion);
ffParsePropFileValues("/usr/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
{"X-KDE-PluginInfo-Version =", &result->deVersion}
});
if(result->deVersion.length == 0)
ffParsePropFileData(instance, "xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion);
if(result->deVersion.length == 0)
ffParsePropFileData(instance, "xsessions/plasma5.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion);
if(result->deVersion.length == 0)
{
ffParsePropFileValues("/usr/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
{"X-KDE-PluginInfo-Version =", &result->deVersion}
});
}
if(result->deVersion.length == 0)
ffParsePropFileData(instance, "wayland-sessions/plasmawayland.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion);
if(result->deVersion.length == 0)
ffParsePropFileData(instance, "wayland-sessions/plasmawayland5.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion);
if(result->deVersion.length == 0 && instance->config.allowSlowOperations)
{
if (ffProcessAppendStdOut(&result->deVersion, (char* const[]){
"plasmashell",
"--version",
NULL
}) == NULL) // plasmashell 5.27.5
ffStrbufSubstrAfterLastC(&result->deVersion, ' ');
}
applyBetterWM(result, getenv("KDEWM"));
}
+20 -17
View File
@@ -5,7 +5,6 @@
#include "util/apple/cf_helpers.h"
#include <IOKit/graphics/IOGraphicsLib.h>
#include <wchar.h>
static double detectGpuTemp(const FFstrbuf* gpuName)
{
@@ -63,23 +62,18 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
gpu->type = FF_GPU_TYPE_UNKNOWN;
ffStrbufInit(&gpu->vendor);
int vendorId;
if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId))
{
const char* vendorStr = ffGetGPUVendorString((unsigned) vendorId);
ffStrbufAppendS(&gpu->vendor, vendorStr);
if (vendorStr == FF_GPU_VENDOR_NAME_APPLE || vendorStr == FF_GPU_VENDOR_NAME_INTEL)
gpu->type = FF_GPU_TYPE_INTEGRATED;
else if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA || vendorStr == FF_GPU_VENDOR_NAME_AMD)
gpu->type = FF_GPU_TYPE_DISCRETE;
}
ffStrbufInit(&gpu->driver);
ffStrbufInit(&gpu->driver); // Ok for both Apple and Intel
ffCfDictGetString(properties, CFSTR("CFBundleIdentifier"), &gpu->driver);
int vram; // Supported on Intel
if(!ffCfDictGetInt(properties, CFSTR("VRAM,totalMB"), &vram))
gpu->dedicated.total = (uint64_t) vram * 1024 * 1024;
if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) // For Apple
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
ffStrbufInit(&gpu->name);
//IOAccelerator returns model property for Apple Silicon, but not for Intel Iris GPUs.
//IOAccelerator returns model / vendor-id properties for Apple Silicon, but not for Intel Iris GPUs.
//Still needs testing for AMD's
if(ffCfDictGetString(properties, CFSTR("model"), &gpu->name))
{
@@ -96,8 +90,17 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance)
ffCfDictGetString(properties, CFSTR("model"), &gpu->name);
}
if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount))
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
ffStrbufInit(&gpu->vendor);
int vendorId;
if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId))
{
const char* vendorStr = ffGetGPUVendorString((unsigned) vendorId);
ffStrbufAppendS(&gpu->vendor, vendorStr);
if (vendorStr == FF_GPU_VENDOR_NAME_APPLE || vendorStr == FF_GPU_VENDOR_NAME_INTEL)
gpu->type = FF_GPU_TYPE_INTEGRATED;
else if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA || vendorStr == FF_GPU_VENDOR_NAME_AMD)
gpu->type = FF_GPU_TYPE_DISCRETE;
}
if(instance->config.gpuTemp)
gpu->temperature = detectGpuTemp(&gpu->name);
+1 -1
View File
@@ -46,7 +46,7 @@ static void pciDetectVendorName(FFGPUResult* gpu, PCIData* pci, struct pci_dev*
static void drmDetectDeviceName(const FFinstance* instance, FFGPUResult* gpu, PCIData* pci, struct pci_dev* device)
{
u8 revId;
u8 revId = 0;
bool revIdSet = false;
#if PCI_LIB_VERSION >= 0x030800
+18 -4
View File
@@ -4,19 +4,33 @@
#include <inttypes.h>
static int isGpuNameEqual(const FFGPUResult* gpu, const FFstrbuf* name)
{
return ffStrbufEqual(&gpu->name, name);
}
const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* instance)
{
DISPLAY_DEVICEW displayDevice = {.cb = sizeof(displayDevice) };
DISPLAY_DEVICEW displayDevice = { .cb = sizeof(displayDevice) };
wchar_t regKey[MAX_PATH] = L"SYSTEM\\CurrentControlSet\\Control\\Video\\{";
const uint32_t regKeyPrefixLength = strlen("SYSTEM\\CurrentControlSet\\Control\\Video\\{");
const uint32_t deviceKeyPrefixLength = strlen("\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{");
const uint32_t regKeyPrefixLength = (uint32_t) wcslen(regKey);
const uint32_t deviceKeyPrefixLength = strlen("\\Registry\\Machine\\") + regKeyPrefixLength;
for (DWORD i = 0; EnumDisplayDevicesW(NULL, i, &displayDevice, 0); ++i)
{
if (displayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) continue;
const uint32_t deviceKeyLength = (uint32_t) wcslen(displayDevice.DeviceKey);
if (wmemcmp(&displayDevice.DeviceKey[deviceKeyLength - 4], L"0000", 4) != 0) continue;
if (__builtin_expect(deviceKeyLength == 100, true))
{
if (wmemcmp(&displayDevice.DeviceKey[deviceKeyLength - 4], L"0000", 4) != 0) continue;
}
else
{
// DeviceKey can be empty. See #484
FF_STRBUF_AUTO_DESTROY gpuName = ffStrbufCreateWS(displayDevice.DeviceString);
if (ffListFirstIndexComp(gpus, &gpuName, (void*) isGpuNameEqual) != gpus->length) continue;
}
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
ffStrbufInit(&gpu->vendor);
+4 -1
View File
@@ -68,6 +68,8 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul
cursorTheme = ffSettingsGetXFConf(instance, "xsettings", "/Gtk/CursorThemeName", FF_VARIANT_TYPE_STRING).strValue;
cursorSize = ffSettingsGetXFConf(instance, "xsettings", "/Gtk/CursorThemeSize", FF_VARIANT_TYPE_INT).intValue;
wallpaper = ffSettingsGetXFConf(instance, "xfce4-desktop", "/backdrop/screen0/monitor0/workspace0/last-image", FF_VARIANT_TYPE_STRING).strValue;
if (!wallpaper) // FIXME: find a way to enumerate possible properties
wallpaper = ffSettingsGetXFConf(instance, "xfce4-desktop", "/backdrop/screen0/monitoreDP-1/workspace0/last-image", FF_VARIANT_TYPE_STRING).strValue;
}
else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_CINNAMON) == 0)
{
@@ -76,6 +78,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul
fontName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/font-name", "org.cinnamon.desktop.interface", NULL, "font-name", FF_VARIANT_TYPE_STRING).strValue;
cursorTheme = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/cursor-theme", "org.cinnamon.desktop.interface", NULL, "cursor-theme", FF_VARIANT_TYPE_STRING).strValue;
cursorSize = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/cursor-size", "org.cinnamon.desktop.interface", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue;
wallpaper = ffSettingsGet(instance, "/org/cinnamon/desktop/background/picture-uri", "org.cinnamon.desktop.background", NULL, "picture-uri", FF_VARIANT_TYPE_STRING).strValue;
}
else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_MATE) == 0)
{
@@ -84,6 +87,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul
fontName = ffSettingsGet(instance, "/org/mate/interface/font-name", "org.mate.interface", NULL, "font-name", FF_VARIANT_TYPE_STRING).strValue;
cursorTheme = ffSettingsGet(instance, "/org/mate/peripherals-mouse/cursor-theme", "org.mate.peripherals-mouse", NULL, "cursor-theme", FF_VARIANT_TYPE_STRING).strValue;
cursorSize = ffSettingsGet(instance, "/org/mate/peripherals-mouse/cursor-size", "org.mate.peripherals-mouse", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue;
wallpaper = ffSettingsGet(instance, "/org/mate/desktop/background", "org.mate.background", NULL, "picture-filename", FF_VARIANT_TYPE_STRING).strValue;
}
else if(
ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_GNOME) == 0 ||
@@ -96,7 +100,6 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul
cursorTheme = ffSettingsGet(instance, "/org/gnome/desktop/interface/cursor-theme", "org.gnome.desktop.interface", NULL, "cursor-theme", FF_VARIANT_TYPE_STRING).strValue;
cursorSize = ffSettingsGet(instance, "/org/gnome/desktop/interface/cursor-size", "org.gnome.desktop.interface", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue;
wallpaper = ffSettingsGet(instance, "/org/gnome/desktop/background/picture-uri", "org.gnome.desktop.background", NULL, "picture-uri", FF_VARIANT_TYPE_STRING).strValue;
// TODO: support other DEs for wallpaper
}
ffThreadMutexUnlock(&mutex);
+1
View File
@@ -21,6 +21,7 @@ typedef struct FFQtResult
FFstrbuf colorScheme;
FFstrbuf icons;
FFstrbuf font;
FFstrbuf wallpaper;
} FFQtResult;
const FFGTKResult* ffDetectGTK2(const FFinstance* instance);
+10 -1
View File
@@ -13,7 +13,8 @@ static inline bool allValuesSet(const FFQtResult* result)
result->widgetStyle.length > 0 &&
result->colorScheme.length > 0 &&
result->icons.length > 0 &&
result->font.length > 0;
result->font.length > 0 &&
result->wallpaper.length > 0;
}
typedef enum PlasmaCategory
@@ -96,6 +97,11 @@ static void detectPlasma(const FFinstance* instance, FFQtResult* result)
if(detectPlasmaFromFile(baseDir.chars, result))
foundAFile = true;
ffStrbufSet(&baseDir, configDir);
ffStrbufAppendS(&baseDir, "plasma-org.kde.plasma.desktop-appletsrc");
ffParsePropFile(baseDir.chars, "Image=", &result->wallpaper);
if(allValuesSet(result))
{
ffStrbufDestroy(&baseDir);
@@ -129,6 +135,8 @@ static void detectLXQt(const FFinstance* instance, FFQtResult* result)
{"icon_theme = ", &result->icons},
{"font = ", &result->font}
});
ffParsePropFileConfig(instance, "pcmanfm-qt/lxqt/settings.conf", "Wallpaper=", &result->wallpaper);
}
const FFQtResult* ffDetectQt(const FFinstance* instance)
@@ -149,6 +157,7 @@ const FFQtResult* ffDetectQt(const FFinstance* instance)
ffStrbufInit(&result.colorScheme);
ffStrbufInit(&result.icons);
ffStrbufInit(&result.font);
ffStrbufInit(&result.wallpaper);
const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance);
+4
View File
@@ -112,6 +112,10 @@ static const char* getProductName(const FFstrbuf* hwModel)
else if(ffStrbufStartsWithS(hwModel, "Mac"))
{
const char* version = hwModel->chars + strlen("Mac");
if(strEqual(version, "14,15")) return "MacBook Air (15-inch, M2, 2023)";
if(strEqual(version, "14,14")) return "Mac Studio (M2 Ultra, 2023, Two Thunderbolt 4 front ports)";
if(strEqual(version, "14,13")) return "Mac Studio (M2 Max, 2023, Two USB-C front ports)";
if(strEqual(version, "14,8")) return "Mac Pro (2023)";
if(strEqual(version, "14,6") ||
strEqual(version, "14,10")) return "MacBook Pro (16-inch, 2023)";
if(strEqual(version, "14,5") ||
+10 -8
View File
@@ -3,19 +3,21 @@
const char* ffDetectMemory(FFMemoryResult* ram)
{
uint64_t length = sizeof(ram->bytesTotal);
if (sysctl((int[]){ CTL_HW, HW_PHYSMEM }, 2, &ram->bytesTotal, &length, NULL, 0))
return "Failed to read hw.physmem";
uint32_t pageSize;
uint64_t length = sizeof(pageSize);
length = sizeof(pageSize);
if (sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &pageSize, &length, NULL, 0))
return "Failed to read hw.pagesize";
ram->bytesTotal = (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_page_count", 0) * pageSize;
if(ram->bytesTotal == 0)
return "Failed to read vm.stats.vm.v_page_count";
// vm.stats.vm.* are int values
int32_t pagesFree = ffSysctlGetInt("vm.stats.vm.v_free_count", 0)
+ ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0)
+ ffSysctlGetInt("vm.stats.vm.v_cache_count", 0);
ram->bytesUsed = ram->bytesTotal
- (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_free_count", 0) * pageSize
- (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_inactive_count", 0) * pageSize
;
ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * pageSize;
return NULL;
}
+5 -13
View File
@@ -1,5 +1,6 @@
extern "C" {
#include "os.h"
#include "common/library.h"
#include "util/windows/unicode.h"
}
#include "util/windows/wmi.hpp"
@@ -20,27 +21,18 @@ static const char* getOsNameByWmi(FFstrbuf* osName)
return "No WMI result returned";
}
static inline void wrapFreeLibrary(HMODULE* module)
{
if(*module)
FreeLibrary(*module);
}
PWSTR WINAPI BrandingFormatString(PCWSTR format);
static const char* getOsNameByWinbrand(FFstrbuf* osName)
{
//https://dennisbabkin.com/blog/?t=how-to-tell-the-real-version-of-windows-your-app-is-running-on#ver_string
if(HMODULE __attribute__((__cleanup__(wrapFreeLibrary))) hWinbrand = LoadLibraryW(L"winbrand.dll"))
{
auto BrandingFormatString = (PWSTR(WINAPI*)(PCWSTR))(void*)GetProcAddress(hWinbrand, "BrandingFormatString");
if(!BrandingFormatString)
return "GetProcAddress(BrandingFormatString) failed";
FF_LIBRARY_LOAD(winbrand, nullptr, "dlopen winbrand" FF_LIBRARY_EXTENSION " failed", "winbrand" FF_LIBRARY_EXTENSION, 1);
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(winbrand, BrandingFormatString);
const wchar_t* rawName = BrandingFormatString(L"%WINDOWS_LONG%");
const wchar_t* rawName = ffBrandingFormatString(L"%WINDOWS_LONG%");
ffStrbufSetWS(osName, rawName);
GlobalFree((HGLOBAL)rawName);
return NULL;
}
return "LoadLibraryW(winbrand.dll) failed";
}
extern "C"
+1
View File
@@ -21,6 +21,7 @@ typedef struct FFPackagesResult
uint32_t nixUser;
uint32_t pacman;
uint32_t pkg;
uint32_t pkgtool;
uint32_t port;
uint32_t rpm;
uint32_t scoop;
+2 -1
View File
@@ -135,7 +135,7 @@ static uint32_t getNixPackagesImpl(char* path)
FFstrbuf output;
ffStrbufInitA(&output, 128);
//https://github.com/LinusDierheimer/fastfetch/issues/195#issuecomment-1191748222
//https://github.com/fastfetch-cli/fastfetch/issues/195#issuecomment-1191748222
FFstrbuf command;
ffStrbufInitA(&command, 255);
ffStrbufAppendS(&command, "for x in $(nix-store --query --requisites ");
@@ -276,6 +276,7 @@ static void getPackageCounts(const FFinstance* instance, FFstrbuf* baseDir, FFPa
packageCounts->nixSystem += getNixPackages(baseDir, "/run/current-system");
packageCounts->pacman += getNumElements(baseDir, "/var/lib/pacman/local", DT_DIR);
packageCounts->pkg += getSQLite3Int(instance, baseDir, "/var/db/pkg/local.sqlite", "SELECT count(id) FROM packages");
packageCounts->pkgtool += getNumElements(baseDir, "/var/log/packages", DT_REG);
packageCounts->rpm += getSQLite3Int(instance, baseDir, "/var/lib/rpm/rpmdb.sqlite", "SELECT count(blob) FROM Packages");
packageCounts->snap += getSnap(baseDir);
packageCounts->xbps += getXBPS(baseDir, "/var/db/xbps");
+34 -13
View File
@@ -10,13 +10,13 @@ static const char* getSystemMonospaceFont(const FFinstance* instance)
{
const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance);
if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Cinnamon") == 0)
if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, "Cinnamon"))
{
const char* systemMonospaceFont = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/monospace-font-name", "org.cinnamon.desktop.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
if(ffStrSet(systemMonospaceFont))
return systemMonospaceFont;
}
else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Mate") == 0)
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, "Mate"))
{
const char* systemMonospaceFont = ffSettingsGet(instance, "/org/mate/interface/monospace-font-name", "org.mate.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
if(ffStrSet(systemMonospaceFont))
@@ -26,9 +26,9 @@ static const char* getSystemMonospaceFont(const FFinstance* instance)
return ffSettingsGet(instance, "/org/gnome/desktop/interface/monospace-font-name", "org.gnome.desktop.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
}
static void detectFromGSettings(const FFinstance* instance, char* profilePath, char* profileList, char* profile, FFTerminalFontResult* terminalFont)
static void detectFromGSettings(const FFinstance* instance, const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont)
{
const char* defaultProfile = ffSettingsGetGSettings(instance, profileList, NULL, "default", FF_VARIANT_TYPE_STRING).strValue;
const char* defaultProfile = ffSettingsGetGSettings(instance, profileList, NULL, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue;
if(!ffStrSet(defaultProfile))
{
ffStrbufAppendF(&terminalFont->error, "Could not get default profile from gsettings: %s", profileList);
@@ -221,20 +221,41 @@ static void detectFootTerminal(const FFinstance* instance, FFTerminalFontResult*
ffFontInitValues(&terminalFont->font, font.chars, &font.chars[equal + strlen("size=")]);
}
static void detectQTerminal(const FFinstance* instance, FFTerminalFontResult* terminalFont)
{
FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();
ffParsePropFileConfigValues(instance, "qterminal.org/qterminal.ini", 2, (FFpropquery[]) {
{"fontFamily=", &fontName},
{"fontSize=", &fontSize},
});
if (fontName.length == 0)
ffStrbufAppendS(&fontName, "monospace");
if (fontSize.length == 0)
ffStrbufAppendS(&fontSize, "12");
ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);
}
void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalShellResult* terminalShell, FFTerminalFontResult* terminalFont)
{
if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "konsole") == 0)
if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "konsole"))
detectKonsole(instance, terminalFont);
else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "xfce4-terminal") == 0)
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "xfce4-terminal"))
detectXFCETerminal(instance, terminalFont);
else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "lxterminal") == 0)
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "lxterminal"))
detectFromConfigFile(instance, "lxterminal/lxterminal.conf", "fontname =", terminalFont);
else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "tilix") == 0)
detectFromGSettings(instance, "/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", terminalFont);
else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "gnome-terminal-") == 0)
detectFromGSettings(instance, "/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", terminalFont);
else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "deepin-terminal") == 0)
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "tilix"))
detectFromGSettings(instance, "/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont);
else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalProcessName, "gnome-terminal-"))
detectFromGSettings(instance, "/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont);
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "mate-terminal"))
detectFromGSettings(instance, "/org/mate/terminal/profiles/", "org.mate.terminal.global", "org.mate.terminal.profile", "default-profile", terminalFont);
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "deepin-terminal"))
detectDeepinTerminal(instance, terminalFont);
else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "foot") == 0)
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "foot"))
detectFootTerminal(instance, terminalFont);
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "qterminal"))
detectQTerminal(instance, terminalFont);
}
+29 -10
View File
@@ -40,11 +40,17 @@ static bool getFileVersion(const char* exePath, FFstrbuf* version)
static bool getExeVersionRaw(FFstrbuf* exe, FFstrbuf* version)
{
return ffProcessAppendStdOut(version, (char* const[]) {
bool ok = ffProcessAppendStdOut(version, (char* const[]) {
exe->chars,
"--version",
NULL
}) == NULL;
if (ok)
{
ffStrbufTrim(version, '\n');
ffStrbufTrim(version, ' ');
}
return ok;
}
static bool getExeVersionGeneral(FFstrbuf* exe, FFstrbuf* version)
@@ -115,11 +121,6 @@ static bool getShellVersionWinPowerShell(FFstrbuf* exe, FFstrbuf* version)
ffStrbufSubstrAfterLastC(version, ' ');
return true;
}
static bool getShellVersionCmd(FFstrbuf* exe, FFstrbuf* version)
{
return getFileVersion(exe->chars, version);
}
#endif
bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
@@ -145,11 +146,11 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
#ifdef _WIN32
if(strcasecmp(exeName, "powershell") == 0 || strcasecmp(exeName, "powershell_ise") == 0)
return getShellVersionWinPowerShell(exe, version);
if(strcasecmp(exeName, "cmd") == 0)
return getShellVersionCmd(exe, version);
#endif
return getFileVersion(exe->chars, version);
#else
return false;
#endif
}
FF_MAYBE_UNUSED static bool getTerminalVersionTermux(FFstrbuf* version)
@@ -203,6 +204,15 @@ FF_MAYBE_UNUSED static bool getTerminalVersionFoot(FFstrbuf* exe, FFstrbuf* vers
return true;
}
FF_MAYBE_UNUSED static bool getTerminalVersionMateTerminal(FFstrbuf* exe, FFstrbuf* version)
{
if(!getExeVersionRaw(exe, version)) return false;
//MATE Terminal 1.26.1
ffStrbufSubstrAfterLastC(version, ' ');
return version->length > 0;
}
#ifdef _WIN32
static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version)
@@ -243,7 +253,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
#if defined(__linux__) || defined(__FreeBSD__)
if(ffStrbufIgnCaseEqualS(processName, "gnome-terminal-"))
if(ffStrbufStartsWithIgnCaseS(processName, "gnome-terminal-"))
return getTerminalVersionGnome(version);
if(ffStrbufIgnCaseEqualS(processName, "konsole"))
@@ -252,12 +262,21 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
if(ffStrbufIgnCaseEqualS(processName, "xfce4-terminal"))
return getExeVersionGeneral(exe, version);//xfce4-terminal 1.0.4 (Xfce 4.18)...
if(ffStrbufIgnCaseEqualS(processName, "terminator"))
return getExeVersionGeneral(exe, version);//terminator 2.1.3
if(ffStrbufIgnCaseEqualS(processName, "deepin-terminal"))
return getExeVersionGeneral(exe, version);//deepin-terminal 5.4.36
if(ffStrbufIgnCaseEqualS(processName, "foot"))
return getTerminalVersionFoot(exe, version);
if(ffStrbufIgnCaseEqualS(processName, "qterminal"))
return getExeVersionRaw(exe, version); //1.2.0
if(ffStrbufIgnCaseEqualS(processName, "mate-terminal"))
return getTerminalVersionMateTerminal(exe, version);
#endif
#ifdef _WIN32
@@ -374,18 +374,29 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance)
ffStrbufInitS(&result.shellPrettyName, "xonsh");
else
{
// https://github.com/LinusDierheimer/fastfetch/discussions/280#discussioncomment-3831734
// https://github.com/fastfetch-cli/fastfetch/discussions/280#discussioncomment-3831734
ffStrbufInitS(&result.shellPrettyName, result.shellExeName);
}
if(ffStrbufEqualS(&result.terminalProcessName, "iTerm.app") || ffStrbufStartsWithS(&result.terminalProcessName, "iTermServer-"))
if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui"))
ffStrbufInitS(&result.terminalPrettyName, "WezTerm");
#if defined(__linux__) || defined(__FreeBSD__)
else if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-"))
ffStrbufInitS(&result.terminalPrettyName, "gnome-terminal");
#elif defined(__APPLE__)
else if(ffStrbufEqualS(&result.terminalProcessName, "iTerm.app") || ffStrbufStartsWithS(&result.terminalProcessName, "iTermServer-"))
ffStrbufInitS(&result.terminalPrettyName, "iTerm");
else if(ffStrbufEqualS(&result.terminalProcessName, "Apple_Terminal"))
ffStrbufInitS(&result.terminalPrettyName, "Apple Terminal");
else if(ffStrbufEqualS(&result.terminalProcessName, "WarpTerminal"))
ffStrbufInitS(&result.terminalPrettyName, "Warp");
else if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui"))
ffStrbufInitS(&result.terminalPrettyName, "WezTerm");
#endif
else if(strncmp(result.terminalExeName, result.terminalProcessName.chars, result.terminalProcessName.length) == 0) // if exeName starts with processName, print it. Otherwise print processName
ffStrbufInitS(&result.terminalPrettyName, result.terminalExeName);
else
@@ -142,7 +142,8 @@ static uint32_t getShellInfo(const FFinstance* instance, FFTerminalShellResult*
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "guake-wrapped") ||
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "fastfetch") || //scoop warps the real binaries with a "shim" exe
ffStrbufIgnCaseEqualS(&result->shellPrettyName, "flashfetch") ||
ffStrbufContainIgnCaseS(&result->shellPrettyName, "debug")
ffStrbufContainIgnCaseS(&result->shellPrettyName, "debug") ||
ffStrbufStartsWithIgnCaseS(&result->shellPrettyName, "ConEmuC") // https://github.com/fastfetch-cli/fastfetch/issues/488#issuecomment-1619982014
) {
ffStrbufClear(&result->shellProcessName);
ffStrbufClear(&result->shellPrettyName);
+2 -2
View File
@@ -22,9 +22,9 @@ next:
if(n->ut_type != USER_PROCESS)
continue;
for(uint32_t i = 0; i < users->length; ++i)
FF_LIST_FOR_EACH(FFstrbuf, user, *users)
{
if(ffStrbufCompS((FFstrbuf*)ffListGet(users, i), n->ut_user) == 0)
if(ffStrbufCompS(user, n->ut_user) == 0)
goto next;
}
+14 -5
View File
@@ -4,14 +4,23 @@
const char* ffDetectWallpaper(const FFinstance* instance, FFstrbuf* result)
{
const FFstrbuf* wallpaper = NULL;
const FFGTKResult* gtk = ffDetectGTK4(instance);
if (!gtk->wallpaper.length)
if (gtk->wallpaper.length)
wallpaper = &gtk->wallpaper;
else
{
const FFQtResult* qt = ffDetectQt(instance);
if (qt->wallpaper.length)
wallpaper = &qt->wallpaper;
}
if (!wallpaper)
return "Failed to detect the current wallpaper path";
if (ffStrbufStartsWithS(&gtk->wallpaper, "file:///"))
ffStrbufAppendS(result, gtk->wallpaper.chars + strlen("file://"));
if (ffStrbufStartsWithS(wallpaper, "file:///"))
ffStrbufAppendS(result, wallpaper->chars + strlen("file://"));
else
ffStrbufAppend(result, &gtk->wallpaper);
ffStrbufAppend(result, wallpaper);
return NULL;
}
+4 -5
View File
@@ -139,7 +139,7 @@ static inline void printCommandHelp(const char* command)
}
else if(strcasecmp(command, "packages-format") == 0)
{
constructAndPrintCommandHelpFormat("packages", "{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} (port), {20} (scoop), {21} (choco)", 21,
constructAndPrintCommandHelpFormat("packages", "{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} (port), {20} (scoop), {21} (choco), {22} (pkgtool)", 22,
"Number of all packages",
"Number of pacman packages",
"Pacman branch on manjaro",
@@ -160,7 +160,8 @@ static inline void printCommandHelp(const char* command)
"Number of brew-cask packages",
"Number of macports packages",
"Number of scoop packages",
"Number of choco packages"
"Number of choco packages",
"Number of pkgtool packages"
);
}
else if(strcasecmp(command, "shell-format") == 0)
@@ -610,7 +611,7 @@ static void optionParseConfigFile(FFinstance* instance, FFdata* data, const char
//Try to load as a relative path
FFstrbuf absolutePath;
FF_STRBUF_AUTO_DESTROY absolutePath;
ffStrbufInitA(&absolutePath, 128);
FF_LIST_FOR_EACH(FFstrbuf, path, instance->state.platform.dataDirs)
@@ -626,8 +627,6 @@ static void optionParseConfigFile(FFinstance* instance, FFdata* data, const char
return;
}
ffStrbufDestroy(&absolutePath);
//File not found
fprintf(stderr, "Error: couldn't find config: %s\n", value);
+127 -34
View File
@@ -328,6 +328,43 @@ static const FFlogo* getLogoArcoLinux()
FF_LOGO_RETURN
}
static const FFlogo* getLogoBSD()
{
FF_LOGO_INIT
FF_LOGO_NAMES("bsd")
FF_LOGO_LINES(
"$1 , ,\n"
" /( )`\n"
" \\ \\___ / |\n"
" /- _ `-/ '\n"
" ($2/\\/ \\ $1\\ /\\\n"
" $2/ / | ` $1\\\n"
" $3O O $2) $1/ |\n"
" $2`-^--'$1`< '\n"
" (_.) _ ) /\n"
" `.___/` /\n"
" `-----' /\n"
"$4<----. __ / __ \\\n"
"$4<----|====$1O)))$4==$1) \\) /$4====|\n"
"<----' $1`--' `.__,' \\\n"
" | |\n"
" \\ / /\\\n"
" $5______$1( (_ / \\______/\n"
" $5,' ,-----' |\n"
" `--{__________)\n"
)
FF_LOGO_COLORS(
"31",
"37",
"34",
"33",
"36"
)
FF_LOGO_COLOR_KEYS("31");
FF_LOGO_COLOR_TITLE("37");
FF_LOGO_RETURN
}
static const FFlogo* getLogoBedrock()
{
FF_LOGO_INIT
@@ -899,6 +936,26 @@ static const FFlogo* getLogoFreeBSD()
FF_LOGO_RETURN
}
static const FFlogo* getLogoFreeBSDSmall()
{
FF_LOGO_INIT
FF_LOGO_NAMES("freebsd_small")
FF_LOGO_LINES(
"$1/\\,-'''''-,/\\\n"
"\\_) (_/\n"
"| |\n"
"| |\n"
" ; ;\n"
" '-_____-'"
)
FF_LOGO_COLORS(
"31" //red
)
FF_LOGO_COLOR_KEYS("31") //red
FF_LOGO_COLOR_TITLE("31") //red
FF_LOGO_RETURN
}
static const FFlogo* getLogoGaruda()
{
FF_LOGO_INIT
@@ -1005,6 +1062,35 @@ static const FFlogo* getLogoGentooSmall()
FF_LOGO_RETURN
}
#define FF_RAW_STRING(x) #x
static const FFlogo* getLogoGhostBSD()
{
FF_LOGO_INIT
FF_LOGO_NAMES("ghostbsd")
FF_LOGO_LINES(
"$1 ,gggggg.\n"
" ,agg9* .g)\n"
" .agg* ._.,gg*\n"
" ,gga* (ggg*'\n"
" ,ga* ,ga*\n"
" ,ga' .ag*\n"
" ,ga' .agga'\n"
" 9g' .agg'g*,a\n"
" 'gggg*',gga'\n"
" .gg*'\n"
" .gga*\n"
" .gga*\n"
" (ga*"
)
FF_LOGO_COLORS(
"34" //blue
)
FF_LOGO_COLOR_KEYS("34"); //blue
FF_LOGO_COLOR_TITLE("31"); //red
FF_LOGO_RETURN
}
static const FFlogo* getLogoKDENeon()
{
FF_LOGO_INIT
@@ -1419,26 +1505,28 @@ static const FFlogo* getLogoWindows11()
FF_LOGO_INIT
FF_LOGO_NAMES("Windows 11", "Windows Server 2022")
FF_LOGO_LINES(
"$1\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"$1///////////////// $2/////////////////\n"
"\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////\n"
"///////////////// /////////////////"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////\n"
"$3///////////////// $4/////////////////"
)
FF_LOGO_COLORS(
"34", //blue
"34", //blue
"34", //blue
"34" //blue
)
FF_LOGO_COLOR_KEYS("33"); //yellow
@@ -1451,8 +1539,7 @@ static const FFlogo* getLogoWindows11Small()
FF_LOGO_INIT
FF_LOGO_NAMES("Windows 11_small", "Windows 11-small")
FF_LOGO_LINES(
"$1\n"
"lllllllll lllllllll\n"
"$1lllllllll lllllllll\n"
"lllllllll lllllllll\n"
"lllllllll lllllllll\n"
"lllllllll lllllllll\n"
@@ -1475,27 +1562,30 @@ static const FFlogo* getLogoWindows8()
FF_LOGO_INIT
FF_LOGO_NAMES("Windows 8", "Windows 8.1", "Windows 10", "Windows Server 2012", "Windows Server 2012 R2", "Windows Server 2016", "Windows Server 2019")
FF_LOGO_LINES(
"$1 ..,\n"
" $2..,\n"
" ....,,:;+ccllll\n"
" ...,,+:; cllllllllllllllllll\n"
",cclllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"$1 ...,,+:; $2cllllllllllllllllll\n"
"$1,cclllllllllll $2lllllllllllllllllll\n"
"$1llllllllllllll $2lllllllllllllllllll\n"
"$1llllllllllllll $2lllllllllllllllllll\n"
"$1llllllllllllll $2lllllllllllllllllll\n"
"$1llllllllllllll $2lllllllllllllllllll\n"
"$1llllllllllllll $2lllllllllllllllllll\n"
"\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"llllllllllllll lllllllllllllllllll\n"
"`'ccllllllllll lllllllllllllllllll\n"
" `' \\*:: :ccllllllllllllllll\n"
"$3llllllllllllll $4lllllllllllllllllll\n"
"$3llllllllllllll $4lllllllllllllllllll\n"
"$3llllllllllllll $4lllllllllllllllllll\n"
"$3llllllllllllll $4lllllllllllllllllll\n"
"$3llllllllllllll $4lllllllllllllllllll\n"
"$3`'ccllllllllll $4lllllllllllllllllll\n"
"$3 `' \\*:: $4:ccllllllllllllllll\n"
" ````''*::cll\n"
" ``"
)
FF_LOGO_COLORS(
"36", //cyan
"36", //cyan
"36", //cyan
"36" //cyan
)
FF_LOGO_COLOR_KEYS("33"); //yellow
@@ -2525,6 +2615,7 @@ GetLogoMethod* ffLogoBuiltinGetAll()
getLogoArtix,
getLogoArtixSmall,
getLogoBedrock,
getLogoBSD,
getLogoCachyOS,
getLogoCachyOSSmall,
getLogoCelOS,
@@ -2543,10 +2634,12 @@ GetLogoMethod* ffLogoBuiltinGetAll()
getLogoFedoraSmall,
getLogoFedoraOld,
getLogoFreeBSD,
getLogoFreeBSDSmall,
getLogoGaruda,
getLogoGarudaSmall,
getLogoGentoo,
getLogoGentooSmall,
getLogoGhostBSD,
getLogoKDENeon,
getLogoKISSLinux,
getLogoKubuntu,
+3 -1
View File
@@ -2,6 +2,8 @@
#include "common/io/io.h"
#include "common/printing.h"
#include <limits.h>
#ifdef __APPLE__
#include <sys/syslimits.h>
#elif _WIN32
@@ -49,8 +51,8 @@ static bool printImageIterm(FFinstance* instance)
return false;
}
ffPrintCharTimes(' ', instance->config.logo.paddingLeft);
ffPrintCharTimes('\n', instance->config.logo.paddingTop);
ffPrintCharTimes(' ', instance->config.logo.paddingLeft);
FFstrbuf base64 = base64Encode(&buf);
instance->state.logoWidth = instance->config.logo.width + instance->config.logo.paddingLeft + instance->config.logo.paddingRight;
instance->state.logoHeight = instance->config.logo.paddingTop + instance->config.logo.height;
+3 -1
View File
@@ -3,7 +3,7 @@
#include "detection/packages/packages.h"
#define FF_PACKAGES_MODULE_NAME "Packages"
#define FF_PACKAGES_NUM_FORMAT_ARGS 21
#define FF_PACKAGES_NUM_FORMAT_ARGS 22
void ffPrintPackages(FFinstance* instance)
{
@@ -57,6 +57,7 @@ void ffPrintPackages(FFinstance* instance)
FF_PRINT_PACKAGE(port)
FF_PRINT_PACKAGE(scoop)
FF_PRINT_PACKAGE(choco)
FF_PRINT_PACKAGE(pkgtool)
//Fix linter warning of unused value of all
(void) all;
@@ -87,6 +88,7 @@ void ffPrintPackages(FFinstance* instance)
{FF_FORMAT_ARG_TYPE_UINT, &counts->port},
{FF_FORMAT_ARG_TYPE_UINT, &counts->scoop},
{FF_FORMAT_ARG_TYPE_UINT, &counts->choco},
{FF_FORMAT_ARG_TYPE_UINT, &counts->pkgtool},
});
}
}
+7
View File
@@ -121,6 +121,13 @@ static inline void ffStrbufInit(FFstrbuf* strbuf)
strbuf->chars = CHAR_NULL_PTR;
}
static inline FFstrbuf ffStrbufCreate()
{
FFstrbuf result;
ffStrbufInit(&result);
return result;
}
static inline void ffStrbufInitNS(FFstrbuf* strbuf, uint32_t length, const char* str)
{
ffStrbufInit(strbuf);
+7 -1
View File
@@ -98,7 +98,13 @@ void ffPlatformPathAddEnv(FFlist* dirs, const char* env)
uint32_t startIndex = 0;
while (startIndex < value.length)
{
uint32_t colonIndex = ffStrbufNextIndexC(&value, startIndex, ':');
#ifdef _WIN32
const char separator = ';';
#else
const char separator = ':';
#endif
uint32_t colonIndex = ffStrbufNextIndexC(&value, startIndex, separator);
value.chars[colonIndex] = '\0';
if(!ffStrSet(value.chars + startIndex))