From f629c24dbc2b9465cefd55a3aea4c810f6d0beb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 30 May 2026 13:06:38 +0200 Subject: [PATCH 1/4] Bootmgr (Haiku): Preliminary implementation --- CMakeLists.txt | 2 +- src/detection/bootmgr/bootmgr_haiku.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/detection/bootmgr/bootmgr_haiku.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 23fa855f13..baa770075b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1204,7 +1204,7 @@ elseif(Haiku) src/detection/battery/battery_haiku.c src/detection/bios/bios_windows.c src/detection/board/board_windows.c - src/detection/bootmgr/bootmgr_nosupport.c + src/detection/bootmgr/bootmgr_haiku.cpp src/detection/brightness/brightness_nosupport.c src/detection/btrfs/btrfs_nosupport.c src/detection/chassis/chassis_windows.c diff --git a/src/detection/bootmgr/bootmgr_haiku.cpp b/src/detection/bootmgr/bootmgr_haiku.cpp new file mode 100644 index 0000000000..72358fca0a --- /dev/null +++ b/src/detection/bootmgr/bootmgr_haiku.cpp @@ -0,0 +1,17 @@ +extern "C" { + #include "bootmgr.h" + #include "common/io.h" +} + +const char* ffDetectBootmgr(FFBootmgrResult* result) { + // TODO: glob haiku_loader.* + check EFI partition + if (ffPathExists("/system/haiku_loader.bios_ia32", FF_PATHTYPE_FILE)) { + ffStrbufSetStatic(&result->firmware, "/system/haiku_loader.bios_ia32"); + } + + ffStrbufSetStatic(&result->name, "haiku_loader"); + + // TODO: detectSecureBoot(&result->secureBoot); + + return NULL; +} From aff5853fab6f38510c04f86e7e0b36c9a0e237b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 30 May 2026 17:01:45 +0200 Subject: [PATCH 2/4] Brightness (Haiku): Implement --- CMakeLists.txt | 2 +- src/detection/brightness/brightness_haiku.cpp | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/detection/brightness/brightness_haiku.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index baa770075b..8d882d1de8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1205,7 +1205,7 @@ elseif(Haiku) src/detection/bios/bios_windows.c src/detection/board/board_windows.c src/detection/bootmgr/bootmgr_haiku.cpp - src/detection/brightness/brightness_nosupport.c + src/detection/brightness/brightness_haiku.cpp src/detection/btrfs/btrfs_nosupport.c src/detection/chassis/chassis_windows.c src/detection/cpu/cpu_haiku.c diff --git a/src/detection/brightness/brightness_haiku.cpp b/src/detection/brightness/brightness_haiku.cpp new file mode 100644 index 0000000000..84cbf54afb --- /dev/null +++ b/src/detection/brightness/brightness_haiku.cpp @@ -0,0 +1,46 @@ +extern "C" { +#include "brightness.h" +#include "common/strutil.h" +} + +#include +#include + +const char* ffDetectBrightness(FF_A_UNUSED FFBrightnessOptions* options, FFlist* result) { + // We need a valid be_app to query the app_server here. + BApplication app("application/x-vnd.fastfetch-cli-fastfetch"); + BScreen screen{}; // default screen is the main one + + do { + if (!screen.IsValid()) { + continue; + } + + float value = 1.0f; + status_t status = screen.GetBrightness(&value); + if (status != B_OK) { + continue; + } + + monitor_info monitor; + // WARNING: This is experimental new Haiku API + status_t err = screen.GetMonitorInfo(&monitor); + + FFBrightnessResult* brightness = FF_LIST_ADD(FFBrightnessResult, *result); + + if (err == B_OK) { + ffStrbufInitF(&brightness->name, "%s %s (%ld)", monitor.vendor, monitor.name, screen.ID().id); + ffStrbufTrimRightSpace(&brightness->name); + } else { + ffStrbufInitF(&brightness->name, "Screen %ld", screen.ID().id); + } + + brightness->max = 1.0f; + brightness->min = 0.0f; + brightness->current = value; + brightness->builtin = true; + + } while (screen.SetToNext() == B_OK); + + return NULL; +} From fc005836084570a9d9220a8e4b5c181f42601f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 30 May 2026 22:15:32 +0200 Subject: [PATCH 3/4] WMTheme (Haiku): implement --- CMakeLists.txt | 2 +- src/detection/wmtheme/wmtheme_haiku.cpp | 30 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/detection/wmtheme/wmtheme_haiku.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d882d1de8..a0acece859 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1257,7 +1257,7 @@ elseif(Haiku) 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/wmtheme/wmtheme_haiku.cpp src/detection/camera/camera_nosupport.c ) elseif(GNU) diff --git a/src/detection/wmtheme/wmtheme_haiku.cpp b/src/detection/wmtheme/wmtheme_haiku.cpp new file mode 100644 index 0000000000..243eaa43e4 --- /dev/null +++ b/src/detection/wmtheme/wmtheme_haiku.cpp @@ -0,0 +1,30 @@ +extern "C" { +#include "fastfetch.h" +#include "wmtheme.h" +} + +#include +#include + +bool ffDetectWmTheme(FFstrbuf* themeOrError) +{ + // We need a valid be_app to query the app_server here. + BApplication app("application/x-vnd.fastfetch-cli-fastfetch"); + + DecorInfoUtility *util = new DecorInfoUtility(); + DecorInfo* decor = NULL; + + if (util) { + decor = util->CurrentDecorator(); + if (decor) { + ffStrbufAppendS(themeOrError, decor->Name().String()); + } + delete util; + if (decor) { + return true; + } + } + + ffStrbufAppendS(themeOrError, "Failed to get DecorInfo"); + return false; +} From cf827943d9cbc130673b8baf3652fe2784775b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 31 May 2026 11:11:31 +0200 Subject: [PATCH 4/4] OS (Haiku): Fix warnings --- src/detection/os/os_haiku.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/detection/os/os_haiku.c b/src/detection/os/os_haiku.c index 40dad2220c..1a3c40cfaa 100644 --- a/src/detection/os/os_haiku.c +++ b/src/detection/os/os_haiku.c @@ -1,6 +1,7 @@ #include "os.h" #include #include +#include void ffDetectOSImpl(FFOSResult* os) { ffStrbufSetStatic(&os->name, "Haiku"); @@ -32,7 +33,7 @@ void ffDetectOSImpl(FFOSResult* os) { int32 relVer = ver / 0x10000; ver %= 0x10000; if (ver == 0) { - ffStrbufSetF(&os->version, "R%d", relVer); + ffStrbufSetF(&os->version, "R%" B_PRId32, relVer); } else { relVer++; @@ -40,16 +41,16 @@ void ffDetectOSImpl(FFOSResult* os) { if (ver < B_HAIKU_VERSION_1_PRE_BETA_1) { int32 alphaVer = ver / 0x100; if (isPre) { - ffStrbufSetF(&os->version, "R%dA%d-", relVer, alphaVer + 1); + ffStrbufSetF(&os->version, "R%" B_PRId32 "A%ld-", relVer, alphaVer + 1); } else { - ffStrbufSetF(&os->version, "R%dA%d", relVer, alphaVer); + ffStrbufSetF(&os->version, "R%" B_PRId32 "A%ld", relVer, alphaVer); } } else if (ver < 0x00010000 /* B_HAIKU_VERSION_1 */) { int32 betaVer = (ver - B_HAIKU_VERSION_1_ALPHA_4) / 0x100; if (isPre) { - ffStrbufSetF(&os->version, "R%dB%d-", relVer, betaVer + 1); + ffStrbufSetF(&os->version, "R%" B_PRId32 "B%ld-", relVer, betaVer + 1); } else { - ffStrbufSetF(&os->version, "R%dB%d", relVer, betaVer); + ffStrbufSetF(&os->version, "R%" B_PRId32 "B%ld", relVer, betaVer); } } } @@ -59,7 +60,7 @@ void ffDetectOSImpl(FFOSResult* os) { if (!os->version.length) { system_info sys; if (get_system_info(&sys) == B_OK) { - ffStrbufAppendF(&os->version, "R%ldx", sys.kernel_version); + ffStrbufAppendF(&os->version, "R%" B_PRIx64, sys.kernel_version); } } }