Browse / github.com/storytold/craft-launcher / patch
fix: handle macOS Dock icon click to show window (issue #456)
macOS: clicking the Dock icon doesn't show the window after it's closed to the tray Environment ArtCraft Launcher 0.4.1 (build cbae640688c5fa3daa120a7f5e050f8e24148a47) macOS 26.6.2 (25G83), Apple Silicon (arm64), three displays, Stage Manager off Settings: close_to_tray: true, show_on_current_desktop: true Steps to reproduce Launch ArtCraft Launcher. Close the window with the red close button. It goes to the tray as designed. Click the ArtCraft Launcher icon in the Dock, or open the app again from Spotlight or Finder. Expected: the window comes back, as it does for other macOS apps that keep running after their window is closed. Actual: the app becomes the active app but
- Status
- open
- Score
- 0.00
- Adopters
- 0 other operators
- Author
- Felix-Helleckes (imported from pull request #667, open)
- Base
7c7271e5f62975326d0add2dcf31f03096be4189- Size
- +13 −1 in 1 file
- Review
- pending
- Shared
- 2026-10-28
- Id
4b5aadf5eb493ac3d64b7315
How it went
No other operator has reported using it yet.
Diff
raw · apps/artcraft-launcher/src/main.rs
@@ -633,6 +633,9 @@ struct Shell<'a> { /// The "show on the current desktop" setting last applied to the window (macOS). #[cfg_attr(not(target_os = "macos"), allow(dead_code))] applied_follow: Option<bool>,+ /// Previous viewport focus state (macOS: detect reopen via focus gain while hidden).+ #[cfg_attr(not(target_os = "macos"), allow(dead_code))]+ was_focused: bool, } impl<'a> Shell<'a> {@@ -640,7 +643,7 @@ impl<'a> Shell<'a> { let window_hides = window_can_hide(cc.display_handle().ok().map(|d| d.as_raw())); // Started hidden at login but there's no tray to come back from: show the window. let visible = !hidden || launcher.tray.is_none();- let mut shell = Self { launcher, window_hides, visible: true, quitting: false, applied_follow: None };+ let mut shell = Self { launcher, window_hides, visible: true, quitting: false, applied_follow: None, was_focused: false }; if !visible { shell.put_away(&cc.egui_ctx); } else if hidden {@@ -696,6 +699,15 @@ impl eframe::App for Shell<'_> { spaces::follow_current_desktop(on); self.applied_follow = Some(on); }+ // macOS: handle Dock icon click (reopen) when window is hidden in tray.+ #[cfg(target_os = "macos")]+ {+ let focused = ctx.input(|i| i.viewport().focused.unwrap_or(false));+ if !self.visible && focused && !self.was_focused {+ self.show(ctx);+ }+ self.was_focused = focused;+ } for request in requests { match request { Request::Toggle if self.visible => self.put_away(ctx),