From 3456b0cf8971adffc2ed55aef3bcdb757e60abea Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 2 Nov 2026 00:33:50 +0700 Subject: [PATCH] The macOS Dock shows the app's icon at the same size as other apps' eframe makes a window icon the app's Dock icon on macOS, and the window icon was the full tile, not the bundle's icon padded to Apple's icon grid, so it looked bigger than other apps' (#102). On macOS the window gets an empty icon, which keeps the bundle's (no icon at all would bring eframe's own). --- apps/craft-anything/src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/craft-anything/src/main.rs b/apps/craft-anything/src/main.rs index 62194396..04c9ef68 100644 --- a/apps/craft-anything/src/main.rs +++ b/apps/craft-anything/src/main.rs @@ -30,7 +30,7 @@ fn main() -> eframe::Result { let hub = Arc::new(AiHub::new(engine.clone())); log::info!("engine and AI ready; opening the window"); - let mut viewport = eframe::egui::ViewportBuilder::default() + let viewport = eframe::egui::ViewportBuilder::default() .with_title("Craft Anything") .with_app_id("ai.storyteller.craft-anything") .with_inner_size([1360.0, 860.0]) @@ -39,9 +39,11 @@ fn main() -> eframe::Result { .with_decorations(false) .with_resizable(true) .with_drag_and_drop(true); - if let Ok(icon) = eframe::icon_data::from_png_bytes(craft_anything_ui_egui::APP_ICON_PNG) { - viewport = viewport.with_icon(Arc::new(icon)); - } + // On macOS a window icon replaces the Dock icon, and the bundle's own icon is the one padded to + // Apple's icon grid (the full tile looked bigger than other apps', #102). An empty icon keeps + // the bundle's; no icon at all would bring eframe's own. + let icon = if cfg!(target_os = "macos") { None } else { eframe::icon_data::from_png_bytes(craft_anything_ui_egui::APP_ICON_PNG).ok() }; + let viewport = viewport.with_icon(Arc::new(icon.unwrap_or_default())); #[cfg_attr(not(windows), expect(unused_mut, reason = "only Windows picks its own graphics adapter"))] let mut options = eframe::NativeOptions { viewport, ..Default::default() }; #[cfg(windows)]