mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
Merge branch 'fastfetch-cli:dev' into dev
This commit is contained in:
commit
21020545ad
@ -30,6 +30,8 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "DragonFly")
|
||||
set(DragonFly TRUE CACHE BOOL "..." FORCE)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
|
||||
set(SunOS TRUE CACHE BOOL "..." FORCE)
|
||||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
|
||||
set(Haiku TRUE CACHE BOOL "..." FORCE)
|
||||
elseif(NOT APPLE AND NOT WIN32)
|
||||
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
|
||||
endif()
|
||||
@ -139,7 +141,7 @@ set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=retu
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion")
|
||||
|
||||
if(WIN32 OR ENABLE_DIRECTX_HEADERS)
|
||||
if(WIN32 OR HAIKU OR ENABLE_DIRECTX_HEADERS)
|
||||
enable_language(CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
|
||||
@ -1088,6 +1090,74 @@ elseif(SunOS)
|
||||
src/util/platform/FFPlatform_unix.c
|
||||
src/util/binary_linux.c
|
||||
)
|
||||
elseif(Haiku)
|
||||
list(APPEND LIBFASTFETCH_SRC
|
||||
src/common/io/io_unix.c
|
||||
src/common/netif/netif_haiku.c
|
||||
src/common/networking_linux.c
|
||||
src/common/processing_linux.c
|
||||
src/detection/battery/battery_nosupport.c
|
||||
src/detection/bios/bios_nosupport.c
|
||||
src/detection/board/board_nosupport.c
|
||||
src/detection/bootmgr/bootmgr_nosupport.c
|
||||
src/detection/brightness/brightness_nosupport.c
|
||||
src/detection/btrfs/btrfs_nosupport.c
|
||||
src/detection/chassis/chassis_nosupport.c
|
||||
src/detection/cpu/cpu_nosupport.c
|
||||
src/detection/cpucache/cpucache_nosupport.c
|
||||
src/detection/cpuusage/cpuusage_nosupport.c
|
||||
src/detection/cursor/cursor_nosupport.c
|
||||
src/detection/bluetooth/bluetooth_nosupport.c
|
||||
src/detection/bluetoothradio/bluetoothradio_nosupport.c
|
||||
src/detection/disk/disk_nosupport.c
|
||||
src/detection/dns/dns_linux.c
|
||||
src/detection/physicaldisk/physicaldisk_nosupport.c
|
||||
src/detection/physicalmemory/physicalmemory_nosupport.c
|
||||
src/detection/diskio/diskio_nosupport.c
|
||||
src/detection/displayserver/displayserver_haiku.cpp
|
||||
src/detection/font/font_haiku.cpp
|
||||
src/detection/gpu/gpu_nosupport.c
|
||||
src/detection/gpu/gpu_pci.c
|
||||
src/detection/gtk_qt/gtk.c
|
||||
src/detection/host/host_nosupport.c
|
||||
src/detection/icons/icons_nosupport.c
|
||||
src/detection/initsystem/initsystem_nosupport.c
|
||||
src/detection/keyboard/keyboard_nosupport.c
|
||||
src/detection/libc/libc_nosupport.c
|
||||
src/detection/lm/lm_nosupport.c
|
||||
src/detection/loadavg/loadavg_nosupport.c
|
||||
src/detection/locale/locale_linux.c
|
||||
src/detection/localip/localip_linux.c
|
||||
src/detection/gamepad/gamepad_nosupport.c
|
||||
src/detection/media/media_nosupport.c
|
||||
src/detection/memory/memory_haiku.c
|
||||
src/detection/mouse/mouse_nosupport.c
|
||||
src/detection/netio/netio_nosupport.c
|
||||
src/detection/opengl/opengl_linux.c
|
||||
src/detection/os/os_haiku.c
|
||||
src/detection/packages/packages_haiku.c
|
||||
src/detection/poweradapter/poweradapter_nosupport.c
|
||||
src/detection/processes/processes_haiku.c
|
||||
src/detection/gtk_qt/qt.c
|
||||
src/detection/sound/sound_nosupport.c
|
||||
src/detection/swap/swap_haiku.c
|
||||
src/detection/terminalfont/terminalfont_linux.c
|
||||
src/detection/terminalshell/terminalshell_linux.c
|
||||
src/detection/terminalsize/terminalsize_linux.c
|
||||
src/detection/theme/theme_nosupport.c
|
||||
src/detection/tpm/tpm_nosupport.c
|
||||
src/detection/uptime/uptime_haiku.c
|
||||
src/detection/users/users_linux.c
|
||||
src/detection/wallpaper/wallpaper_nosupport.c
|
||||
src/detection/wifi/wifi_nosupport.c
|
||||
src/detection/wm/wm_nosupport.c
|
||||
src/detection/de/de_nosupport.c
|
||||
src/detection/wmtheme/wmtheme_nosupport.c
|
||||
src/detection/camera/camera_nosupport.c
|
||||
src/detection/zpool/zpool_nosupport.c
|
||||
src/util/platform/FFPlatform_unix.c
|
||||
src/util/binary_linux.c
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DIRECTX_HEADERS)
|
||||
@ -1112,6 +1182,9 @@ endif()
|
||||
if(LINUX)
|
||||
check_function_exists(statx HAVE_STATX)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
check_function_exists(pipe2 HAVE_PIPE2)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SYSTEM_YYJSON)
|
||||
find_package(yyjson)
|
||||
@ -1226,6 +1299,10 @@ if(HAVE_WCWIDTH)
|
||||
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_WCWIDTH)
|
||||
endif()
|
||||
|
||||
if(HAVE_PIPE2)
|
||||
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_PIPE2)
|
||||
endif()
|
||||
|
||||
if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
|
||||
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})
|
||||
@ -1534,6 +1611,12 @@ elseif(ANDROID)
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
elseif(Haiku)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "network"
|
||||
PRIVATE "be"
|
||||
PRIVATE "gnu"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(libfastfetch
|
||||
|
2
LICENSE
2
LICENSE
@ -1,7 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021-2023 Linus Dierheimer
|
||||
Copyright (c) 2022-2024 Carter Li
|
||||
Copyright (c) 2022-2025 Carter Li
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
fastfetch (2.35.0) jammy; urgency=medium
|
||||
|
||||
* Update to 2.35.0
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Sun, 26 Jan 2025 10:15:22 +0800
|
||||
|
||||
fastfetch (2.34.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.34.1
|
||||
|
2
debian/files
vendored
2
debian/files
vendored
@ -1 +1 @@
|
||||
fastfetch_2.34.1_source.buildinfo universe/utils optional
|
||||
fastfetch_2.35.0_source.buildinfo universe/utils optional
|
||||
|
@ -310,7 +310,7 @@ void listFilesRecursively(uint32_t baseLength, FFstrbuf* folder, uint8_t indenta
|
||||
continue;
|
||||
|
||||
bool isDir = false;
|
||||
#ifndef __sun
|
||||
#if !defined(__sun) && !defined(__HAIKU__)
|
||||
if(entry->d_type != DT_UNKNOWN && entry->d_type != DT_LNK)
|
||||
isDir = entry->d_type == DT_DIR;
|
||||
else
|
||||
|
63
src/common/netif/netif_haiku.c
Normal file
63
src/common/netif/netif_haiku.c
Normal file
@ -0,0 +1,63 @@
|
||||
#include "netif.h"
|
||||
#include "common/io/io.h"
|
||||
#include "util/mallocHelper.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sockio.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// loosely based on Haiku's src/bin/network/route/route.cpp
|
||||
|
||||
bool ffNetifGetDefaultRouteImpl(char iface[IF_NAMESIZE + 1], uint32_t* ifIndex)
|
||||
{
|
||||
// TODO: AF_INET6
|
||||
FF_AUTO_CLOSE_FD int pfRoute = socket(AF_INET, SOCK_RAW, AF_INET);
|
||||
if (pfRoute < 0)
|
||||
return false;
|
||||
|
||||
struct ifconf config;
|
||||
config.ifc_len = sizeof(config.ifc_value);
|
||||
if (ioctl(pfRoute, SIOCGRTSIZE, &config, sizeof(struct ifconf)) < 0)
|
||||
return false;
|
||||
|
||||
int size = config.ifc_value;
|
||||
if (size == 0)
|
||||
return false;
|
||||
|
||||
FF_AUTO_FREE void *buffer = malloc(size);
|
||||
if (buffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
config.ifc_len = size;
|
||||
config.ifc_buf = buffer;
|
||||
if (ioctl(pfRoute, SIOCGRTTABLE, &config, sizeof(struct ifconf)) < 0)
|
||||
return false;
|
||||
|
||||
struct ifreq *interface = (struct ifreq*)buffer;
|
||||
struct ifreq *end = (struct ifreq*)((uint8_t*)buffer + size);
|
||||
|
||||
while (interface < end) {
|
||||
if (interface->ifr_route.flags & RTF_DEFAULT) {
|
||||
strlcpy(iface, interface->ifr_name, IF_NAMESIZE);
|
||||
*ifIndex = if_nametoindex(interface->ifr_name);
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t addressSize = 0;
|
||||
if (interface->ifr_route.destination != NULL)
|
||||
addressSize += interface->ifr_route.destination->sa_len;
|
||||
if (interface->ifr_route.mask != NULL)
|
||||
addressSize += interface->ifr_route.mask->sa_len;
|
||||
if (interface->ifr_route.gateway != NULL)
|
||||
addressSize += interface->ifr_route.gateway->sa_len;
|
||||
|
||||
interface = (struct ifreq*)((addr_t)interface + IF_NAMESIZE
|
||||
+ sizeof(struct route_entry) + addressSize);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
@ -32,9 +32,9 @@
|
||||
|
||||
enum { FF_PIPE_BUFSIZ = 8192 };
|
||||
|
||||
static inline int ffPipe2(int *fds, int flags)
|
||||
static inline int ffPipe2(int* fds, int flags)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
#ifndef FF_HAVE_PIPE2
|
||||
if(pipe(fds) == -1)
|
||||
return -1;
|
||||
fcntl(fds[0], F_SETFL, fcntl(fds[0], F_GETFL) | flags);
|
||||
@ -301,7 +301,12 @@ void ffProcessGetInfoLinux(pid_t pid, FFstrbuf* processName, FFstrbuf* exe, cons
|
||||
if (proc)
|
||||
{
|
||||
char** argv = kvm_getargv(kd, proc, 0);
|
||||
if (argv) ffStrbufSetS(exe, argv[0]);
|
||||
if (argv)
|
||||
{
|
||||
const char* arg0 = argv[0];
|
||||
if (arg0[0] == '-') arg0++;
|
||||
ffStrbufSetS(exe, arg0);
|
||||
}
|
||||
}
|
||||
kvm_close(kd);
|
||||
|
||||
|
@ -6,6 +6,11 @@
|
||||
// warning: 'AVCaptureDeviceTypeExternalUnknown' is deprecated
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#ifdef MAC_OS_VERSION_14_0
|
||||
// To make fastfetch compiled on newer macOS versions runs on older ones
|
||||
AVF_EXPORT __attribute__((weak_import)) AVCaptureDeviceType const AVCaptureDeviceTypeExternal;
|
||||
#endif
|
||||
|
||||
const char* ffDetectCamera(FFlist* result)
|
||||
{
|
||||
#ifdef MAC_OS_X_VERSION_10_15
|
||||
|
@ -15,6 +15,7 @@ static double detectCpuTemp(const FFstrbuf* cpuName)
|
||||
case 1: error = ffDetectSmcTemps(FF_TEMP_CPU_M1X, &result); break;
|
||||
case 2: error = ffDetectSmcTemps(FF_TEMP_CPU_M2X, &result); break;
|
||||
case 3: error = ffDetectSmcTemps(FF_TEMP_CPU_M3X, &result); break;
|
||||
case 4: error = ffDetectSmcTemps(FF_TEMP_CPU_M4X, &result); break;
|
||||
default: error = "Unsupported Apple Silicon CPU";
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#define FF_CPUINFO_PATH "/proc/cpuinfo"
|
||||
|
||||
static double parseHwmonDir(FFstrbuf* dir, FFstrbuf* buffer)
|
||||
{
|
||||
//https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
|
||||
@ -297,30 +299,22 @@ static const char* parseCpuInfo(
|
||||
(cpu->vendor.length == 0 && ffParsePropLine(line, "vendor_id :", &cpu->vendor)) ||
|
||||
(physicalCoresBuffer->length == 0 && ffParsePropLine(line, "cpu cores :", physicalCoresBuffer)) ||
|
||||
(cpuMHz->length == 0 && ffParsePropLine(line, "cpu MHz :", cpuMHz)) ||
|
||||
#endif
|
||||
|
||||
#if __arm__ || __aarch64__
|
||||
#elif __arm__ || __aarch64__
|
||||
(cpuImplementer->length == 0 && ffParsePropLine(line, "CPU implementer :", cpuImplementer)) ||
|
||||
(cpu->name.length == 0 && ffParsePropLine(line, "Hardware :", &cpu->name)) || //For Android devices
|
||||
#endif
|
||||
|
||||
#if __powerpc__ || __powerpc
|
||||
#elif __powerpc__ || __powerpc
|
||||
(cpuMHz->length == 0 && ffParsePropLine(line, "clock :", cpuMHz)) || //For POWER
|
||||
(cpu->name.length == 0 && ffParsePropLine(line, "cpu :", &cpu->name)) || //For POWER
|
||||
#endif
|
||||
|
||||
#if __mips__ || __mips
|
||||
#elif __mips__ || __mips
|
||||
(cpu->name.length == 0 && ffParsePropLine(line, "cpu model :", &cpu->name)) || //For MIPS
|
||||
#endif
|
||||
|
||||
#if __loongarch__
|
||||
#elif __loongarch__
|
||||
(cpu->name.length == 0 && ffParsePropLine(line, "Model Name :", &cpu->name)) ||
|
||||
(cpuMHz->length == 0 && ffParsePropLine(line, "CPU MHz :", cpuMHz)) ||
|
||||
#endif
|
||||
|
||||
#if __riscv__ || __loongarch__
|
||||
#elif __riscv__ || __riscv
|
||||
(cpuIsa->length == 0 && ffParsePropLine(line, "isa :", cpuIsa)) ||
|
||||
(cpuUarch->length == 0 && ffParsePropLine(line, "uarch :", cpuUarch)) ||
|
||||
#else
|
||||
(cpu->name.length == 0 && ffParsePropLine(line, "model name :", &cpu->name)) ||
|
||||
#endif
|
||||
|
||||
false
|
||||
@ -445,8 +439,8 @@ FF_MAYBE_UNUSED static uint16_t getPackageCount(FFstrbuf* cpuinfo)
|
||||
FF_MAYBE_UNUSED static const char* detectCPUX86(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
|
||||
if (!ffReadFileBuffer("/proc/cpuinfo", &cpuinfo) || cpuinfo.length == 0)
|
||||
return "ffReadFileBuffer(\"/proc/cpuinfo\") failed";
|
||||
if (!ffReadFileBuffer(FF_CPUINFO_PATH, &cpuinfo) || cpuinfo.length == 0)
|
||||
return "ffReadFileBuffer(\"" FF_CPUINFO_PATH "\") failed";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY physicalCoresBuffer = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY cpuMHz = ffStrbufCreate();
|
||||
@ -575,6 +569,30 @@ FF_MAYBE_UNUSED static void detectSocName(FFCPUResult* cpu)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __loongarch__
|
||||
FF_MAYBE_UNUSED static uint16_t getLoongarchPropCount(FFstrbuf* cpuinfo, const char* key)
|
||||
{
|
||||
const char* p = cpuinfo->chars;
|
||||
uint64_t low = 0, high = 0;
|
||||
uint32_t keylen = (uint32_t) strlen(key);
|
||||
|
||||
while ((p = memmem(p, cpuinfo->length - (uint32_t) (p - cpuinfo->chars), key, keylen)))
|
||||
{
|
||||
if (!p) break;
|
||||
p += keylen;
|
||||
char* pend;
|
||||
unsigned long id = strtoul(p, &pend, 10);
|
||||
if (__builtin_expect(id > 64, false))
|
||||
high |= 1 << (id - 64);
|
||||
else
|
||||
low |= 1 << id;
|
||||
p = pend;
|
||||
}
|
||||
|
||||
return (uint16_t) (__builtin_popcountll(low) + __builtin_popcountll(high));
|
||||
}
|
||||
#endif
|
||||
|
||||
FF_MAYBE_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
cpu->coresPhysical = cpu->coresLogical = (uint16_t) get_nprocs_conf();
|
||||
@ -591,8 +609,8 @@ FF_MAYBE_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options,
|
||||
if (cpu->name.length == 0)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY cpuinfo = ffStrbufCreateA(PROC_FILE_BUFFSIZ);
|
||||
if (!ffReadFileBuffer("/proc/cpuinfo", &cpuinfo) || cpuinfo.length == 0)
|
||||
return "ffReadFileBuffer(\"/proc/cpuinfo\") failed";
|
||||
if (!ffReadFileBuffer(FF_CPUINFO_PATH, &cpuinfo) || cpuinfo.length == 0)
|
||||
return "ffReadFileBuffer(\"" FF_CPUINFO_PATH "\") failed";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY cpuMHz = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY cpuIsa = ffStrbufCreate();
|
||||
@ -629,6 +647,10 @@ FF_MAYBE_UNUSED static const char* detectCPUOthers(const FFCPUOptions* options,
|
||||
ffStrbufAppend(&cpu->name, &cpuIsa);
|
||||
}
|
||||
}
|
||||
#elif __loongarch__
|
||||
cpu->packages = getLoongarchPropCount(&cpuinfo, "\npackage\t\t\t:");
|
||||
cpu->coresPhysical = getLoongarchPropCount(&cpuinfo, "\ncore\t\t\t:");
|
||||
if (cpu->packages > 1) cpu->coresPhysical *= cpu->packages;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
72
src/detection/displayserver/displayserver_haiku.cpp
Normal file
72
src/detection/displayserver/displayserver_haiku.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
extern "C" {
|
||||
#include "displayserver.h"
|
||||
#include "common/settings.h"
|
||||
#include "common/processing.h"
|
||||
}
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <Screen.h>
|
||||
|
||||
extern "C" void ffConnectDisplayServerImpl(FFDisplayServerResult* ds);
|
||||
|
||||
static void detectDisplays(FFDisplayServerResult* ds)
|
||||
{
|
||||
// We need a valid be_app to query the app_server here.
|
||||
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
|
||||
BScreen s{}; // default screen is the main one
|
||||
bool main = true;
|
||||
|
||||
do
|
||||
{
|
||||
if (!s.IsValid())
|
||||
continue;
|
||||
|
||||
display_mode mode;
|
||||
if (s.GetMode(&mode) != B_OK)
|
||||
continue;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateA(128);
|
||||
monitor_info monitor;
|
||||
// WARNING: This is experimental new Haiku API
|
||||
status_t err = s.GetMonitorInfo(&monitor);
|
||||
if (err == B_OK) {
|
||||
ffStrbufSetF(&name, "%s %s", monitor.vendor, monitor.name);
|
||||
}
|
||||
|
||||
uint32_t width = (uint32_t) s.Frame().Width() + 1;
|
||||
uint32_t height = (uint32_t) (uint32_t)s.Frame().Height() + 1;
|
||||
double scaleFactor = (double) 1.0;
|
||||
ffdsAppendDisplay(ds,
|
||||
width,
|
||||
height,
|
||||
(double)mode.timing.pixel_clock * 1000 / (mode.timing.v_total * mode.timing.h_total),
|
||||
(uint32_t) (width / scaleFactor + .5),
|
||||
(uint32_t) (height / scaleFactor + .5),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
main,
|
||||
s.ID().id,
|
||||
0,
|
||||
0,
|
||||
"BScreen"
|
||||
);
|
||||
main = false;
|
||||
} while (s.SetToNext() == B_OK);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
||||
{
|
||||
ffStrbufSetStatic(&ds->wmProcessName, "app_server");
|
||||
ffStrbufSetStatic(&ds->wmPrettyName, "Application Server");
|
||||
ffStrbufSetStatic(&ds->dePrettyName, "Application Kit");
|
||||
|
||||
detectDisplays(ds);
|
||||
}
|
@ -4,9 +4,15 @@
|
||||
#include "util/mallocHelper.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#ifdef __HAIKU__
|
||||
#define RESOLV_CONF "/system/settings/network/resolv.conf"
|
||||
#else
|
||||
#define RESOLV_CONF "/etc/resolv.conf"
|
||||
#endif
|
||||
|
||||
const char* ffDetectDNS(FFDNSOptions* options, FFlist* results)
|
||||
{
|
||||
FF_AUTO_CLOSE_FILE FILE* file = fopen(FASTFETCH_TARGET_DIR_ROOT "/etc/resolv.conf", "r");
|
||||
FF_AUTO_CLOSE_FILE FILE* file = fopen(FASTFETCH_TARGET_DIR_ROOT RESOLV_CONF, "r");
|
||||
if (!file)
|
||||
return "fopen (" FASTFETCH_TARGET_DIR_ROOT "/etc/resolv.conf) failed";
|
||||
|
||||
|
@ -10,6 +10,7 @@ typedef struct FFFontResult
|
||||
* Linux / BSD: Qt, GTK2, GTK3, GTK4
|
||||
* MacOS: System, User, System Mono, User Mono
|
||||
* Windows: Caption, Menu, Message, Status
|
||||
* Haiku: Plain, Menu, Bold, Mono
|
||||
* Other: Unset, Unset, Unset, Unset
|
||||
*/
|
||||
FFstrbuf fonts[FF_DETECT_FONT_NUM_FONTS];
|
||||
|
65
src/detection/font/font_haiku.cpp
Normal file
65
src/detection/font/font_haiku.cpp
Normal file
@ -0,0 +1,65 @@
|
||||
extern "C" {
|
||||
#include "common/font.h"
|
||||
#include "common/parsing.h"
|
||||
#include "font.h"
|
||||
}
|
||||
|
||||
#include <Application.h>
|
||||
#include <Font.h>
|
||||
#include <Menu.h>
|
||||
|
||||
extern "C" {
|
||||
const char* ffDetectFontImpl(FFFontResult* result);
|
||||
}
|
||||
|
||||
static void generateString(FFFontResult* font)
|
||||
{
|
||||
const char* types[] = { "Plain", "Menu", "Bold", "Mono" };
|
||||
for(uint32_t i = 0; i < ARRAY_SIZE(types); ++i)
|
||||
{
|
||||
if(i == 0 || !ffStrbufEqual(&font->fonts[i - 1], &font->fonts[i]))
|
||||
{
|
||||
if(i > 0)
|
||||
ffStrbufAppendS(&font->display, "], ");
|
||||
ffStrbufAppendF(&font->display, "%s [%s", font->fonts[i].chars, types[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufAppendS(&font->display, " / ");
|
||||
ffStrbufAppendS(&font->display, types[i]);
|
||||
}
|
||||
}
|
||||
ffStrbufAppendC(&font->display, ']');
|
||||
}
|
||||
|
||||
const char* ffDetectFontImpl(FFFontResult* result)
|
||||
{
|
||||
struct menu_info menuInfo;
|
||||
const BFont *f;
|
||||
// We need a valid be_app to query the app_server here.
|
||||
BApplication app("application/x-vnd.fastfetch-cli-fastfetch");
|
||||
|
||||
if ((f = be_plain_font) != NULL)
|
||||
{
|
||||
f->GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style);
|
||||
ffStrbufAppendF(&result->fonts[0], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)f->Size());
|
||||
}
|
||||
if (get_menu_info(&menuInfo) == B_OK)
|
||||
{
|
||||
ffStrbufAppendF(&result->fonts[1], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)menuInfo.font_size);
|
||||
}
|
||||
if ((f = be_bold_font) != NULL)
|
||||
{
|
||||
f->GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style);
|
||||
ffStrbufAppendF(&result->fonts[2], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)f->Size());
|
||||
}
|
||||
if ((f = be_fixed_font) != NULL)
|
||||
{
|
||||
f->GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style);
|
||||
ffStrbufAppendF(&result->fonts[3], "%s %s (%dpt)", menuInfo.f_family, menuInfo.f_style, (int)f->Size());
|
||||
}
|
||||
|
||||
generateString(result);
|
||||
|
||||
return NULL;
|
||||
}
|
@ -21,6 +21,7 @@ static double detectGpuTemp(const FFstrbuf* gpuName)
|
||||
case 1: error = ffDetectSmcTemps(FF_TEMP_GPU_M1X, &result); break;
|
||||
case 2: error = ffDetectSmcTemps(FF_TEMP_GPU_M2X, &result); break;
|
||||
case 3: error = ffDetectSmcTemps(FF_TEMP_GPU_M3X, &result); break;
|
||||
case 4: error = ffDetectSmcTemps(FF_TEMP_GPU_M4X, &result); break;
|
||||
default: error = "Unsupported Apple Silicon GPU";
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,9 @@ const char* ffGpuDetectMetal(FFlist* gpus)
|
||||
gpu->type = device.location == MTLDeviceLocationBuiltIn ? FF_GPU_TYPE_INTEGRATED : FF_GPU_TYPE_DISCRETE;
|
||||
gpu->index = (uint32_t) device.locationNumber;
|
||||
#endif
|
||||
|
||||
if (device.hasUnifiedMemory && device.recommendedMaxWorkingSetSize > 0)
|
||||
gpu->shared.total = device.recommendedMaxWorkingSetSize;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ struct FFNvmlData {
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetPciInfo_v3)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetTemperature)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetMemoryInfo_v2)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetMemoryInfo)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetNumGpuCores)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetMaxClockInfo)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetUtilizationRates)
|
||||
@ -36,6 +37,7 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetPciInfo_v3)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetTemperature)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMemoryInfo_v2)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMemoryInfo)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetNumGpuCores)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMaxClockInfo)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetUtilizationRates)
|
||||
@ -130,6 +132,15 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
|
||||
result.memory->total = memory.used + memory.free;
|
||||
result.memory->used = memory.used;
|
||||
}
|
||||
else
|
||||
{
|
||||
nvmlMemory_t memory_v1;
|
||||
if (nvmlData.ffnvmlDeviceGetMemoryInfo(device, &memory_v1) == NVML_SUCCESS)
|
||||
{
|
||||
result.memory->total = memory_v1.total;
|
||||
result.memory->used = memory_v1.used;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.coreCount)
|
||||
|
@ -56,6 +56,18 @@ typedef struct {
|
||||
// https://github.com/NVIDIA/nvidia-settings/issues/78#issuecomment-1012837988
|
||||
enum { nvmlMemory_v2 = (unsigned int)(sizeof(nvmlMemory_v2_t) | (2 << 24U)) };
|
||||
|
||||
// https://docs.nvidia.com/deploy/nvml-api/structnvmlMemory__t.html#structnvmlMemory__t
|
||||
// Memory allocation information for a device (v1)
|
||||
typedef struct
|
||||
{
|
||||
// Total physical device memory (in bytes)
|
||||
unsigned long long total;
|
||||
// Unallocated device memory (in bytes)
|
||||
unsigned long long free;
|
||||
// Sum of Reserved and Allocated device memory (in bytes)
|
||||
unsigned long long used;
|
||||
} nvmlMemory_t;
|
||||
|
||||
// https://docs.nvidia.com/deploy/nvml-api/group__nvmlDeviceEnumvs.html#group__nvmlDeviceEnumvs_1g805c0647be9996589fc5e3f6ff680c64
|
||||
// Clock types
|
||||
typedef enum {
|
||||
@ -124,6 +136,8 @@ extern nvmlReturn_t nvmlDeviceGetPciInfo_v3(nvmlDevice_t device, nvmlPciInfo_t*
|
||||
extern nvmlReturn_t nvmlDeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int* temp);
|
||||
// Retrieves the amount of used, free, reserved and total memory available on the device, in bytes. The reserved amount is supported on version 2 only
|
||||
extern nvmlReturn_t nvmlDeviceGetMemoryInfo_v2(nvmlDevice_t device, nvmlMemory_v2_t* memory);
|
||||
// Retrieves the amount of used, free, total memory available on the device, in bytes.
|
||||
extern nvmlReturn_t nvmlDeviceGetMemoryInfo(nvmlDevice_t device, nvmlMemory_t *memory);
|
||||
// Gets the device's core count
|
||||
extern nvmlReturn_t nvmlDeviceGetNumGpuCores(nvmlDevice_t device, unsigned int* numCores);
|
||||
// Retrieves the maximum clock speeds for the device
|
||||
|
@ -18,23 +18,27 @@
|
||||
#include <linux/if.h>
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__NetBSD__) || defined(__HAIKU__)
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_dl.h>
|
||||
#else
|
||||
#include <netpacket/packet.h>
|
||||
#endif
|
||||
#ifdef __sun
|
||||
#if defined(__sun) || defined(__HAIKU__)
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
|
||||
static const FFLocalIpNIFlag niFlagOptions[] = {
|
||||
{ IFF_UP, "UP" },
|
||||
{ IFF_BROADCAST, "BROADCAST" },
|
||||
#ifdef IFF_DEBUG
|
||||
{ IFF_DEBUG, "DEBUG" },
|
||||
#endif
|
||||
{ IFF_LOOPBACK, "LOOPBACK" },
|
||||
{ IFF_POINTOPOINT, "POINTOPOINT" },
|
||||
#ifdef IFF_RUNNING
|
||||
{ IFF_RUNNING, "RUNNING" },
|
||||
#endif
|
||||
{ IFF_NOARP, "NOARP" },
|
||||
{ IFF_PROMISC, "PROMISC" },
|
||||
{ IFF_ALLMULTI, "ALLMULTI" },
|
||||
@ -64,6 +68,13 @@ static const FFLocalIpNIFlag niFlagOptions[] = {
|
||||
#endif
|
||||
#ifdef IFF_CANTCONFIG
|
||||
{ IFF_CANTCONFIG, "CANTCONFIG" },
|
||||
#endif
|
||||
#ifdef __HAIKU__
|
||||
{ IFF_AUTOUP, "IAUTOUP" },
|
||||
{ IFF_SIMPLEX, "SIMPLEX" },
|
||||
{ IFF_LINK, "LINK" },
|
||||
{ IFF_AUTO_CONFIGURED, "AUTO_CONFIGURED" },
|
||||
{ IFF_CONFIGURING, "CONFIGURING" },
|
||||
#endif
|
||||
// sentinel
|
||||
{},
|
||||
@ -128,8 +139,12 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
|
||||
for (struct ifaddrs* ifa = ifAddrStruct; ifa; ifa = ifa->ifa_next)
|
||||
{
|
||||
if (!ifa->ifa_addr || !(ifa->ifa_flags & IFF_RUNNING))
|
||||
if (!ifa->ifa_addr)
|
||||
continue;
|
||||
#ifdef IFF_RUNNING
|
||||
if (!(ifa->ifa_flags & IFF_RUNNING))
|
||||
continue;
|
||||
#endif
|
||||
|
||||
bool isDefaultRoute = ffStrEquals(defaultRouteIfName, ifa->ifa_name);
|
||||
if ((options->showType & FF_LOCALIP_TYPE_DEFAULT_ROUTE_ONLY_BIT) && !isDefaultRoute)
|
||||
@ -190,7 +205,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
|
||||
addNewIp(results, ifa->ifa_name, addressBuffer, AF_INET6, isDefaultRoute, flags, !(options->showType & FF_LOCALIP_TYPE_ALL_IPS_BIT));
|
||||
}
|
||||
#if __FreeBSD__ || __OpenBSD__ || __APPLE__ || __NetBSD__
|
||||
#if __FreeBSD__ || __OpenBSD__ || __APPLE__ || __NetBSD__ || __HAIKU__
|
||||
else if (ifa->ifa_addr->sa_family == AF_LINK)
|
||||
{
|
||||
if (!(options->showType & FF_LOCALIP_TYPE_MAC_BIT))
|
||||
|
15
src/detection/memory/memory_haiku.c
Normal file
15
src/detection/memory/memory_haiku.c
Normal file
@ -0,0 +1,15 @@
|
||||
#include "memory.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
const char* ffDetectMemory(FFMemoryResult* ram)
|
||||
{
|
||||
system_info info;
|
||||
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;
|
||||
|
||||
return NULL;
|
||||
}
|
20
src/detection/os/os_haiku.c
Normal file
20
src/detection/os/os_haiku.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include "os.h"
|
||||
#include "common/io/io.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
void ffDetectOSImpl(FFOSResult* os)
|
||||
{
|
||||
system_info info;
|
||||
|
||||
ffStrbufSetStatic(&os->name, "Haiku");
|
||||
ffStrbufSetStatic(&os->prettyName, "Haiku");
|
||||
|
||||
ffStrbufSetStatic(&os->id, "haiku");
|
||||
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return;
|
||||
ffStrbufAppendF(&os->version, "R%lld", info.kernel_version);
|
||||
|
||||
// TODO: check kernel resources?
|
||||
}
|
@ -100,7 +100,7 @@ uint32_t ffPackagesGetNumElements(const char* dirname, bool isdir)
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
#ifndef __sun
|
||||
#if !defined(__sun) && !defined(__HAIKU__)
|
||||
if(entry->d_type != DT_UNKNOWN && entry->d_type != DT_LNK)
|
||||
ok = entry->d_type == (isdir ? DT_DIR : DT_REG);
|
||||
else
|
||||
|
13
src/detection/packages/packages_haiku.c
Normal file
13
src/detection/packages/packages_haiku.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "packages.h"
|
||||
|
||||
#include "common/io/io.h"
|
||||
|
||||
void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
||||
{
|
||||
// TODO: Use the Package Kit C++ API instead (would account for disabled packages)
|
||||
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PKG_BIT))
|
||||
result->pkg = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/system/packages", false);
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PKGSRC_BIT))
|
||||
result->pkgsrc = ffPackagesGetNumElements(FASTFETCH_TARGET_DIR_ROOT "/boot/home/config/packages", false);
|
||||
}
|
14
src/detection/processes/processes_haiku.c
Normal file
14
src/detection/processes/processes_haiku.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include "processes.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
const char* ffDetectProcesses(uint32_t* result)
|
||||
{
|
||||
system_info info;
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return "Error getting system info";
|
||||
|
||||
*result = info.used_teams;
|
||||
|
||||
return NULL;
|
||||
}
|
17
src/detection/swap/swap_haiku.c
Normal file
17
src/detection/swap/swap_haiku.c
Normal file
@ -0,0 +1,17 @@
|
||||
#include "swap.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
enum { FFMaxNSwap = 8 };
|
||||
|
||||
const char* ffDetectSwap(FFSwapResult* swap)
|
||||
{
|
||||
system_info info;
|
||||
if (get_system_info(&info) != B_OK)
|
||||
return "Error getting system info";
|
||||
|
||||
swap->bytesTotal = B_PAGE_SIZE * info.max_swap_pages;
|
||||
swap->bytesUsed = B_PAGE_SIZE * (info.max_swap_pages - info.free_swap_pages);
|
||||
|
||||
return NULL;
|
||||
}
|
11
src/detection/uptime/uptime_haiku.c
Normal file
11
src/detection/uptime/uptime_haiku.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include "uptime.h"
|
||||
#include "common/time.h"
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
const char* ffDetectUptime(FFUptimeResult* result)
|
||||
{
|
||||
result->uptime = system_time() / 1000;
|
||||
result->bootTime = (real_time_clock_usecs() / 1000) - result->uptime;
|
||||
return NULL;
|
||||
}
|
@ -42,6 +42,8 @@
|
||||
#define FF_SYSNAME "OpenBSD"
|
||||
#elif defined(__NetBSD__)
|
||||
#define FF_SYSNAME "NetBSD"
|
||||
#elif defined(__HAIKU__)
|
||||
#define FF_SYSNAME "Haiku"
|
||||
#else
|
||||
#define FF_SYSNAME "unknown"
|
||||
#endif
|
||||
|
20
src/logo/ascii/filotimo.txt
Normal file
20
src/logo/ascii/filotimo.txt
Normal file
@ -0,0 +1,20 @@
|
||||
O '
|
||||
lk: ;xX. .0K '
|
||||
lodk ;lldK' .lld0O :okX;
|
||||
lloo0 ;lllld0: .lllllxKx :clllkKk
|
||||
llllo, ;llllloox .clllllloxK :cclllllx0N
|
||||
lllll, ;llllllll .cclllllllo' :cccclllllld
|
||||
cllll, ;cclllllc .ccccllllll' :cccccclllll
|
||||
cllll, ;cccllllc ccccccllll' ::cccccclllc
|
||||
ccccl, ;cccccllc :cccccccll' :::ccccccclc
|
||||
ccccc, ;cccccccc ::cccccccl' :::::ccccccc
|
||||
:cccc, ;:ccccccc ::::cccccc' :::::::ccccc
|
||||
:cccc, ;:::ccccc ::::::cccc' :;::::::ccc:
|
||||
:::cc, ;:::::ccc ;:::::::cc' :;;:::::::c:
|
||||
:::::, ;:::::::c ;;:::::::c' :;;;;:::::::
|
||||
:::::, ;;::::::c ;;;;::::::' :;;;;;::::::
|
||||
;::::, ,;;;::::c ,;;;;;::::' ';;;;;;::::
|
||||
';;::, ;;;;::: .;;;;;::' .;;;;;::
|
||||
;;;, ;;;;: .;;;:' ;;;:
|
||||
,;, ,;: ';'
|
||||
.,
|
19
src/logo/ascii/nexalinux.txt
Normal file
19
src/logo/ascii/nexalinux.txt
Normal file
@ -0,0 +1,19 @@
|
||||
********
|
||||
*****************
|
||||
**********************
|
||||
**************************
|
||||
********** **********
|
||||
******* *********
|
||||
****** ********
|
||||
******* *******
|
||||
********* ****** *******
|
||||
***************** ******
|
||||
*************** *******
|
||||
*********** *******
|
||||
********
|
||||
********
|
||||
*********
|
||||
**********
|
||||
*********
|
||||
*******
|
||||
***
|
@ -1428,10 +1428,10 @@ static const FFlogo E[] = {
|
||||
.colorKeys = FF_COLOR_FG_MAGENTA,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
// Endeavour
|
||||
// EndeavourOS
|
||||
{
|
||||
.names = {"Endeavour", "endeavour-linux", "endeavouros", "endeavouros-linux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUR,
|
||||
.names = {"EndeavourOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUROS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
FF_COLOR_FG_RED,
|
||||
@ -1440,11 +1440,11 @@ static const FFlogo E[] = {
|
||||
.colorKeys = FF_COLOR_FG_MAGENTA,
|
||||
.colorTitle = FF_COLOR_FG_RED,
|
||||
},
|
||||
// EndeavourSmall
|
||||
// EndeavourOSSmall
|
||||
{
|
||||
.names = {"Endeavour_small", "endeavour-linux_small", "endeavouros_small", "endeavouros-linux_small"},
|
||||
.names = {"EndeavourOS_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUR_SMALL,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUROS_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
@ -1690,6 +1690,16 @@ static const FFlogo F[] = {
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// Filotimo
|
||||
{
|
||||
.names = {"filotimo"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FILOTIMO,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_WHITE,
|
||||
},
|
||||
// Finnix
|
||||
{
|
||||
.names = {"Finnix"},
|
||||
@ -1990,7 +2000,7 @@ static const FFlogo H[] = {
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_YELLOW,
|
||||
FF_COLOR_FG_WHITE,
|
||||
FF_COLOR_FG_DEFAULT,
|
||||
FF_COLOR_FG_GREEN,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_RED,
|
||||
@ -2552,7 +2562,7 @@ static const FFlogo L[] = {
|
||||
},
|
||||
// LinuxMintOld
|
||||
{
|
||||
.names = {"linux-mint_old", "linux-mint-old"},
|
||||
.names = {"linuxmint_old", "linux-mint_old"},
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_MINT_OLD,
|
||||
.colors = {
|
||||
@ -3048,6 +3058,15 @@ static const FFlogo N[] = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
},
|
||||
// NexaLinux
|
||||
{
|
||||
.names = {"nexalinux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_NEXALINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_LIGHT_BLUE,
|
||||
FF_COLOR_FG_LIGHT_BLUE,
|
||||
},
|
||||
},
|
||||
// Nitrux
|
||||
{
|
||||
.names = {"Nitrux"},
|
||||
@ -3280,7 +3299,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuse
|
||||
{
|
||||
.names = {"opensuse", "open_suse", "open-suse"},
|
||||
.names = {"opensuse"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
@ -3291,7 +3310,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseSmall
|
||||
{
|
||||
.names = {"opensuse_small", "open_suse_small", "open-suse_small"},
|
||||
.names = {"opensuse_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_SMALL,
|
||||
.colors = {
|
||||
@ -3310,7 +3329,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseLeap
|
||||
{
|
||||
.names = {"opensuse_leap", "opensuse leap"},
|
||||
.names = {"opensuse-leap", "opensuse leap"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_LEAP,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
@ -3320,7 +3339,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseLeapOld
|
||||
{
|
||||
.names = {"opensuse_leap_old", "opensuse leap_old"},
|
||||
.names = {"opensuse-leap_old", "opensuse leap_old"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_LEAP_OLD,
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.colors = {
|
||||
@ -3331,7 +3350,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseTumbleweed
|
||||
{
|
||||
.names = {"opensuse-tumbleweed", "opensuse_tumbleweed"},
|
||||
.names = {"opensuse-tumbleweed"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_TUMBLEWEED,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
@ -3341,7 +3360,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// OpenSuseTumbleweedOld
|
||||
{
|
||||
.names = {"opensuse-tumbleweed-old", "opensuse_tumbleweed-old"},
|
||||
.names = {"opensuse-tumbleweed-old"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_TUMBLEWEED_OLD,
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.colors = {
|
||||
@ -3352,7 +3371,7 @@ static const FFlogo O[] = {
|
||||
},
|
||||
// openSUSESlowroll
|
||||
{
|
||||
.names = {"opensuse_slowroll", "opensuse-slowroll", "opensuse-tumbleweed-slowroll"},
|
||||
.names = {"opensuse-slowroll", "opensuse-tumbleweed-slowroll"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENSUSE_SLOWROLL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
@ -3669,7 +3688,7 @@ static const FFlogo P[] = {
|
||||
},
|
||||
// Pop
|
||||
{
|
||||
.names = {"pop", "popos", "pop_os", "pop-linux"},
|
||||
.names = {"pop", "popos"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_POP,
|
||||
.colors = {
|
||||
FF_COLOR_FG_CYAN,
|
||||
@ -3680,7 +3699,7 @@ static const FFlogo P[] = {
|
||||
},
|
||||
// PopSmall
|
||||
{
|
||||
.names = {"pop_small", "popos_small", "pop_os_small", "pop-linux-small"},
|
||||
.names = {"pop_small", "popos_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_POP_SMALL,
|
||||
.colors = {
|
||||
@ -3873,10 +3892,10 @@ static const FFlogo R[] = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
},
|
||||
// Reborn
|
||||
// RebornOS
|
||||
{
|
||||
.names = {"Reborn", "Reborn OS", "reborn-os", "rebornos", "rebornos-linux", "reborn-os-linux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_REBORN,
|
||||
.names = {"RebornOS"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_REBORNOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLACK,
|
||||
FF_COLOR_FG_BLUE,
|
||||
@ -3887,9 +3906,9 @@ static const FFlogo R[] = {
|
||||
},
|
||||
// RebornSmall
|
||||
{
|
||||
.names = {"Reborn_small", "Reborn OS_small", "reborn-os-small", "rebornos_small", "rebornos-linux-small", "reborn-os-linux-small"},
|
||||
.names = {"RebornOS_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_REBORN_SMALL,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_REBORNOS_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
},
|
||||
@ -3952,7 +3971,7 @@ static const FFlogo R[] = {
|
||||
},
|
||||
// RedstarOS
|
||||
{
|
||||
.names = {"redstar", "redstar-os", "redstaros", "redstaros-linux", "redstar-os-linux"},
|
||||
.names = {"redstar", "redstar-os", "redstaros"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_REDSTAR,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@ -4256,7 +4275,7 @@ static const FFlogo S[] = {
|
||||
},
|
||||
// Slackware
|
||||
{
|
||||
.names = {"slackware", "slackware-linux", "slackwarelinux"},
|
||||
.names = {"Slackware"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_SLACKWARE,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@ -4267,7 +4286,7 @@ static const FFlogo S[] = {
|
||||
},
|
||||
// SlackwareSmall
|
||||
{
|
||||
.names = {"slackware-small", "slackware-linux-small", "slackware_small", "slackwarelinux_small"},
|
||||
.names = {"Slackware_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_SLACKWARE_SMALL,
|
||||
.colors = {
|
||||
@ -4326,7 +4345,7 @@ static const FFlogo S[] = {
|
||||
},
|
||||
// SolarisSmall
|
||||
{
|
||||
.names = {"solaris-small", "solaris_small", "sunos-small", "sunos_small"},
|
||||
.names = {"solaris_small", "sunos_small"},
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_SOLARIS_SMALL,
|
||||
.colors = {
|
||||
@ -4337,7 +4356,7 @@ static const FFlogo S[] = {
|
||||
},
|
||||
// Solus
|
||||
{
|
||||
.names = {"solus", "solus-linux"},
|
||||
.names = {"Solus", "solus-linux"},
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_SOLUS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
|
@ -387,13 +387,30 @@ static const FFlogo* logoGetBuiltinDetected(FFLogoSize size)
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
|
||||
logo = logoGetBuiltin(&os->prettyName, size);
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
if (ffStrbufContainC(&os->idLike, ' '))
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||
for (
|
||||
uint32_t start = 0, end = ffStrbufFirstIndexC(&os->idLike, ' ');
|
||||
true;
|
||||
start = end + 1, end = ffStrbufNextIndexC(&os->idLike, start, ' ')
|
||||
)
|
||||
{
|
||||
ffStrbufSetNS(&buf, end - start, os->idLike.chars + start);
|
||||
logo = logoGetBuiltin(&buf, size);
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
|
||||
logo = logoGetBuiltin(&os->idLike, size);
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
if (end >= os->idLike.length)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logo = logoGetBuiltin(&os->idLike, size);
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
}
|
||||
|
||||
logo = logoGetBuiltin(&instance.state.platform.sysinfo.name, size);
|
||||
if(logo != NULL)
|
||||
|
@ -269,7 +269,7 @@ static const char *smcReadValue(io_connect_t conn, const UInt32Char_t key, doubl
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool detectTemp(io_connect_t conn, const char *sensor, double* sum)
|
||||
static bool detectTemp(io_connect_t conn, const char* sensor, double* sum)
|
||||
{
|
||||
double temp = 0;
|
||||
const char* error = smcReadValue(conn, sensor, &temp);
|
||||
@ -280,7 +280,7 @@ static bool detectTemp(io_connect_t conn, const char *sensor, double* sum)
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *ffDetectSmcTemps(enum FFTempType type, double *result)
|
||||
const char* ffDetectSmcTemps(enum FFTempType type, double* result)
|
||||
{
|
||||
static io_connect_t conn;
|
||||
if (!conn)
|
||||
@ -353,6 +353,21 @@ const char *ffDetectSmcTemps(enum FFTempType type, double *result)
|
||||
count += detectTemp(conn, "Tf4E", result); // CPU performance core 12
|
||||
break;
|
||||
|
||||
case FF_TEMP_CPU_M4X:
|
||||
count += detectTemp(conn, "Te05", result); // CPU efficiency core 1
|
||||
count += detectTemp(conn, "Te0S", result); // CPU efficiency core 2
|
||||
count += detectTemp(conn, "Te09", result); // CPU efficiency core 3
|
||||
count += detectTemp(conn, "Te0H", result); // CPU efficiency core 4
|
||||
count += detectTemp(conn, "Tp01", result); // CPU performance core 1
|
||||
count += detectTemp(conn, "Tp05", result); // CPU performance core 2
|
||||
count += detectTemp(conn, "Tp09", result); // CPU performance core 3
|
||||
count += detectTemp(conn, "Tp0D", result); // CPU performance core 4
|
||||
count += detectTemp(conn, "Tp0V", result); // CPU performance core 5
|
||||
count += detectTemp(conn, "Tp0Y", result); // CPU performance core 6
|
||||
count += detectTemp(conn, "Tp0b", result); // CPU performance core 7
|
||||
count += detectTemp(conn, "Tp0e", result); // CPU performance core 8
|
||||
break;
|
||||
|
||||
case FF_TEMP_GPU_INTEL:
|
||||
count += detectTemp(conn, "TCGC", result); // GPU Intel Graphics
|
||||
goto gpu_unknown;
|
||||
@ -390,6 +405,19 @@ const char *ffDetectSmcTemps(enum FFTempType type, double *result)
|
||||
count += detectTemp(conn, "Tf2A", result); // GPU 8
|
||||
break;
|
||||
|
||||
case FF_TEMP_GPU_M4X:
|
||||
count += detectTemp(conn, "Tg0G", result); // GPU 1 (Basic)
|
||||
count += detectTemp(conn, "Tg0H", result); // GPU 2 (Basic)
|
||||
count += detectTemp(conn, "Tg1U", result); // GPU 1 (Pro / Max)
|
||||
count += detectTemp(conn, "Tg1k", result); // GPU 2 (Pro / Max)
|
||||
count += detectTemp(conn, "Tg0K", result); // GPU 3
|
||||
count += detectTemp(conn, "Tg0L", result); // GPU 4
|
||||
count += detectTemp(conn, "Tg0d", result); // GPU 5
|
||||
count += detectTemp(conn, "Tg0e", result); // GPU 6
|
||||
count += detectTemp(conn, "Tg0j", result); // GPU 7
|
||||
count += detectTemp(conn, "Tg0k", result); // GPU 8
|
||||
break;
|
||||
|
||||
case FF_TEMP_BATTERY:
|
||||
count += detectTemp(conn, "TB1T", result); // Battery
|
||||
count += detectTemp(conn, "TB2T", result); // Battery
|
||||
|
@ -15,6 +15,7 @@ enum FFTempType
|
||||
FF_TEMP_CPU_M1X,
|
||||
FF_TEMP_CPU_M2X,
|
||||
FF_TEMP_CPU_M3X,
|
||||
FF_TEMP_CPU_M4X,
|
||||
|
||||
FF_TEMP_GPU_INTEL,
|
||||
FF_TEMP_GPU_AMD,
|
||||
@ -22,10 +23,11 @@ enum FFTempType
|
||||
FF_TEMP_GPU_M1X,
|
||||
FF_TEMP_GPU_M2X,
|
||||
FF_TEMP_GPU_M3X,
|
||||
FF_TEMP_GPU_M4X,
|
||||
|
||||
FF_TEMP_BATTERY,
|
||||
|
||||
FF_TEMP_MEMORY,
|
||||
};
|
||||
|
||||
const char *ffDetectSmcTemps(enum FFTempType type, double* result);
|
||||
const char* ffDetectSmcTemps(enum FFTempType type, double* result);
|
||||
|
@ -14,6 +14,9 @@
|
||||
#include <sys/sysctl.h>
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
#include <sys/sysctl.h>
|
||||
#elif defined(__HAIKU__)
|
||||
#include <image.h>
|
||||
#include <OS.h>
|
||||
#endif
|
||||
|
||||
static void getExePath(FFPlatform* platform)
|
||||
@ -47,6 +50,17 @@ static void getExePath(FFPlatform* platform)
|
||||
ssize_t exePathLen = readlink("/proc/self/path/a.out", exePath, sizeof(exePath) - 1);
|
||||
if (exePathLen >= 0)
|
||||
exePath[exePathLen] = '\0';
|
||||
#elif defined(__HAIKU__)
|
||||
size_t exePathLen = 0;
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
|
||||
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
if (info.type == B_APP_IMAGE) {
|
||||
exePathLen = strlcpy(exePath, info.name, PATH_MAX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (exePathLen > 0)
|
||||
{
|
||||
@ -117,6 +131,9 @@ static void getConfigDirs(FFPlatform* platform)
|
||||
ffPlatformPathAddHome(&platform->configDirs, platform, "Library/Preferences/");
|
||||
ffPlatformPathAddHome(&platform->configDirs, platform, "Library/Application Support/");
|
||||
#endif
|
||||
#if defined(__HAIKU__)
|
||||
ffPlatformPathAddHome(&platform->configDirs, platform, "config/settings/");
|
||||
#endif
|
||||
|
||||
ffPlatformPathAddHome(&platform->configDirs, platform, "");
|
||||
platformPathAddEnv(&platform->configDirs, "XDG_CONFIG_DIRS");
|
||||
@ -185,6 +202,12 @@ static void getSysinfo(FFPlatformSysinfo* info, const struct utsname* uts)
|
||||
ffStrbufAppendS(&info->name, uts->sysname);
|
||||
ffStrbufAppendS(&info->release, uts->release);
|
||||
ffStrbufAppendS(&info->version, uts->version);
|
||||
#ifdef __HAIKU__
|
||||
/* historical reason */
|
||||
if (ffStrEquals(uts->machine, "BePC"))
|
||||
ffStrbufSetStatic(&info->architecture, "i386");
|
||||
else
|
||||
#endif
|
||||
ffStrbufAppendS(&info->architecture, uts->machine);
|
||||
ffStrbufInit(&info->displayVersion);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user