macOS: keep the bundle's icon in the Dock while the launcher runs (#127)

eframe sets the app icon at runtime, and on macOS that replaces the
Dock icon with a raw bitmap (the 256 px PNG we passed, or egui's logo
when none is given), which skips the system's icon treatment. Pass the
empty icon on macOS so eframe leaves the bundle's .icns alone.

Fixes #32.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Val EnfysandClaude Opus 5.5 authored and GitHub committed 2026-10-12 01:53:38 -04:00
1 parent 1f92b7db17
commit ba8a704908
1 file changed
+6 -1
+6 -1
View File
@@ -110,7 +110,12 @@ fn native_options(hidden: bool) -> eframe::NativeOptions {
} else {
viewport.with_decorations(false)
};
if let Some(icon) = icon {
// On macOS the bundle's .icns is the icon. Any icon given to eframe (its egui logo when none
// is) replaces it in the Dock at runtime with a raw bitmap, which skips the system's icon
// treatment, so pass the empty icon, which eframe takes as "leave it alone".
if cfg!(target_os = "macos") {
viewport = viewport.with_icon(egui::IconData::default());
} else if let Some(icon) = icon {
viewport = viewport.with_icon(icon);
}
eframe::NativeOptions { viewport, persist_window: true, wgpu_options: wgpu_options(), ..Default::default() }