From 14c57d116ab6952466dcf44eeace9765d54fdb53 Mon Sep 17 00:00:00 2001 From: D3ns0n <9082743+d3ns0n@users.noreply.github.com> Date: Thu, 16 Jul 2026 21:21:23 +0200 Subject: [PATCH] Fix macOS 26+ dock icon losing system theming On macOS 26 (Tahoe) the runtime dock icon override suppressed the system's Liquid Glass / tinted icon theming. Skip setting a custom dock icon on macOS 26 and later so the themed bundle icon is used. Add is_mac_os_at_least() using NSProcessInfo so the check is a lower bound (covers 27+) and works regardless of the build SDK. Fixes #8816 --- src/libslic3r/MacUtils.hpp | 3 +++ src/libslic3r/MacUtils.mm | 8 ++++++++ src/slic3r/GUI/MainFrame.cpp | 25 +++++++++++++++++-------- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/MacUtils.hpp b/src/libslic3r/MacUtils.hpp index 29366ee3f7..de69579962 100644 --- a/src/libslic3r/MacUtils.hpp +++ b/src/libslic3r/MacUtils.hpp @@ -5,6 +5,9 @@ namespace Slic3r { bool is_macos_support_boost_add_file_log(); int is_mac_version_15(); + +// Returns true when running on macOS `major` or any later version. +bool is_mac_os_at_least(int major); } #endif diff --git a/src/libslic3r/MacUtils.mm b/src/libslic3r/MacUtils.mm index f5fa82fe35..3314d2856d 100644 --- a/src/libslic3r/MacUtils.mm +++ b/src/libslic3r/MacUtils.mm @@ -20,4 +20,12 @@ int is_mac_version_15() return false; } } + +// Runtime check that works regardless of the SDK used to build, and is +// inherently true for the given major version and all later ones. +bool is_mac_os_at_least(int major) +{ + NSOperatingSystemVersion version = { major, 0, 0 }; + return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]; +} }; // namespace Slic3r diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 9da8cff1f9..c50d1e2890 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -47,6 +47,9 @@ #include "Widgets/ProgressDialog.hpp" #include "BindDialog.hpp" #include "../Utils/MacDarkMode.hpp" +#ifdef __APPLE__ +#include "libslic3r/MacUtils.hpp" +#endif #include #include @@ -303,14 +306,20 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_ #ifdef __APPLE__ // Initialize the docker task bar icon. - switch (wxGetApp().get_app_mode()) { - default: - case GUI_App::EAppMode::Editor: - m_taskbar_icon = std::make_unique(wxTBI_DOCK); - m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("BambuStudio-mac_256px.ico"), wxBITMAP_TYPE_ICO), "BambuStudio"); - break; - case GUI_App::EAppMode::GCodeViewer: - break; + // On macOS 26+ (Tahoe) setting a custom dock icon at runtime overrides the + // system's Liquid Glass / tinted icon theming for the app bundle icon. Skip + // it there so the themed bundle icon (Icon.icns) is shown instead. The check + // is a lower bound, so future macOS releases (27+) are covered as well. + if (!is_mac_os_at_least(26)) { + switch (wxGetApp().get_app_mode()) { + default: + case GUI_App::EAppMode::Editor: + m_taskbar_icon = std::make_unique(wxTBI_DOCK); + m_taskbar_icon->SetIcon(wxIcon(Slic3r::var("BambuStudio-mac_256px.ico"), wxBITMAP_TYPE_ICO), "BambuStudio"); + break; + case GUI_App::EAppMode::GCodeViewer: + break; + } } #endif // __APPLE__