Browse / github.com/storytold/craft-launcher / patch
macOS: option to hide the Dock icon while in the menu bar
macOS: option to hide the Dock icon while in the menu bar ## What A new macOS-only setting under **Settings → Running in the background**: **Hide the Dock icon while in the menu bar** (off by default). With it on, closing the window to the menu bar takes ArtCraft Launcher out of the Dock and the app switcher, so it runs from its menu bar icon alone. Opening the window from the menu bar brings the Dock icon back while the window is open, so an open window still shows in Cmd-Tab and keeps its menu bar menus. ## How - `LSUIElement` stays unset, as `AGENTS.md` requires. The new `apps/artcraft-launcher/src/dock.rs` switches the activation poli
- Status
- open
- Score
- 0.00
- Adopters
- 0 other operators
- Author
- mtbhuskies (imported from pull request #860, open)
- Base
c0fa1c69f452bab61ec3fd806646ef4daff9912a- Size
- +92 −5 in 19 files
- Review
- pending
- Shared
- 2026-10-28
- Id
a15fac4864d461eef5d2d07a
How it went
No other operator has reported using it yet.
Diff
raw · AGENTS.md apps/artcraft-launcher/Cargo.toml apps/artcraft-launcher/src/dock.rs apps/artcraft-launcher/src/main.rs crates/native/src/install.rs crates/ui-egui/src/app.rs crates/ui-egui/src/i18n/cs.tsv crates/ui-egui/src/i18n/de.tsv crates/ui-egui/src/i18n/es.tsv crates/ui-egui/src/i18n/fr.tsv crates/ui-egui/src/i18n/hu.tsv crates/ui-egui/src/i18n/ja.tsv crates/ui-egui/src/i18n/pl.tsv crates/ui-egui/src/i18n/pt-BR.tsv crates/ui-egui/src/i18n/ru.tsv crates/ui-egui/src/i18n/zh-CN.tsv crates/ui-egui/src/settings.rs crates/ui-egui/src/settings_dialog.rs crates/ui-egui/tests/ui.rs
@@ -161,7 +161,9 @@ Packaging facts the code relies on: `ai.storyteller.artcraft-launcher`, which toast notifications need. `portable.txt` beside the exe switches on portable mode (`ArtCraftLauncherData\` next to the exe). - The macOS bundle is `ArtCraft Launcher.app` (executable `Contents/MacOS/ArtCraft Launcher`), a- normal Dock app that can also sit in the menu bar: `LSUIElement` must never be set.+ normal Dock app that can also sit in the menu bar: `LSUIElement` must never be set. The opt-in+ "Hide the Dock icon while in the menu bar" setting switches the activation policy at runtime+ instead (`dock.rs`): accessory while the window is hidden, regular while it is open. - Linux: the tray uses StatusNotifierItem over D-Bus and notifications use `org.freedesktop.Notifications`, both in pure Rust (no GTK, appindicator or libdbus). - Inside the Flatpak launcher (`process::in_sandbox()`), apps normally install as host Flatpaks@@ -40,13 +40,13 @@ zbus = "5" [target.'cfg(any(target_os = "macos", target_os = "windows"))'.dependencies] tray-icon = "0.25" -# macOS only: which desktop (Space) the window shows on (spaces.rs) and the "Reduce motion"-# setting (motion.rs). Safe AppKit calls only, and already in Cargo.lock through winit and+# macOS only: which desktop (Space) the window shows on (spaces.rs), whether the launcher is in+# the Dock while it waits in the menu bar (dock.rs) and the "Reduce motion" setting (motion.rs). Safe AppKit calls only, and already in Cargo.lock through winit and # tray-icon; pinned exactly to those versions. [target.'cfg(target_os = "macos")'.dependencies] objc2 = "=0.6.5" objc2-foundation = { version = "=0.3.2", default-features = false, features = ["std", "NSArray", "NSEnumerator"] }-objc2-app-kit = { version = "=0.3.2", default-features = false, features = ["std", "NSAccessibility", "NSApplication", "NSResponder", "NSWindow", "NSWorkspace"] }+objc2-app-kit = { version = "=0.3.2", default-features = false, features = ["std", "NSAccessibility", "NSApplication", "NSResponder", "NSRunningApplication", "NSWindow", "NSWorkspace"] } # Windows only: the "Animation effects" setting (motion.rs). Already in Cargo.lock through # artcraft-launcher-native.new file mode 100644@@ -0,0 +1,19 @@+//! macOS only: whether the launcher has a Dock icon.+//!+//! The bundle is a normal Dock app (`LSUIElement` is never set). With "Hide the Dock icon while+//! in the menu bar" on, closing the window to the menu bar switches the app to the accessory+//! activation policy, which takes it out of the Dock and the app switcher, and opening the window+//! switches it back to regular, so an open window behaves like any other app's.++use objc2::MainThreadMarker;+use objc2_app_kit::{NSApplication, NSApplicationActivationPolicy};++/// Puts the launcher in the Dock (`true`) or leaves only its menu bar icon (`false`). Must run on+/// the main thread, as the UI does; elsewhere it does nothing.+pub fn show_in_dock(on: bool) {+ let Some(mtm) = MainThreadMarker::new() else { return };+ let policy = if on { NSApplicationActivationPolicy::Regular } else { NSApplicationActivationPolicy::Accessory };+ if !NSApplication::sharedApplication(mtm).setActivationPolicy(policy) {+ log::warn!("couldn't {} the Dock icon", if on { "show" } else { "hide" });+ }+}@@ -5,6 +5,8 @@ #![cfg_attr(windows, windows_subsystem = "windows")] #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +#[cfg(target_os = "macos")]+mod dock; mod logging; mod motion; mod settings_file;@@ -500,6 +502,10 @@ impl Host for DesktopHost { cfg!(target_os = "macos") } + fn has_dock(&self) -> bool {+ cfg!(target_os = "macos")+ }+ fn login_item(&self) -> Option<bool> { Some(login::is_enabled()) }@@ -739,6 +745,9 @@ impl<'a> Shell<'a> { let on = self.launcher.ui.settings.show_on_current_desktop; spaces::follow_current_desktop(on); self.applied_follow = Some(on);+ // Back in the Dock before the window is ordered front, so it's a regular app again+ // (app switcher, menu bar menus) while its window is open.+ dock::show_in_dock(true); } if self.window_hides { ctx.send_viewport_cmd(egui::ViewportCommand::Visible(true));@@ -755,6 +764,12 @@ impl<'a> Shell<'a> { if self.window_hides { self.visible = false; ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));+ // Only the menu bar icon is left to bring the window back, so leave the Dock only+ // where there is one.+ #[cfg(target_os = "macos")]+ if self.launcher.tray.is_some() && self.launcher.ui.settings.hide_dock_icon_in_tray {+ dock::show_in_dock(false);+ } } else { self.launcher.closed_to_tray = true; ctx.send_viewport_cmd(egui::ViewportCommand::Close);@@ -1201,7 +1201,7 @@ pub mod macos { use artcraft_launcher_core::version::Version; - use super::{CraftApp, InstallSource, Installed, Path, PathBuf, Paths, Release, process, staging_dir, swap_into_place};+ use super::{CraftApp, InstallSource, Installed, Path, PathBuf, Paths, Release, process, swap_into_place}; /// `/Applications` when we can write there, else `~/Applications`. fn applications_dir(existing: Option<&Installed>, destination: Option<&Path>) -> Result<PathBuf, String> {@@ -46,6 +46,11 @@ pub trait Host { fn has_desktops(&self) -> bool { false }+ /// The OS has a Dock (macOS) the launcher can leave while it waits in the menu bar, so the+ /// "hide the Dock icon" setting applies.+ fn has_dock(&self) -> bool {+ false+ } /// `Some(enabled)` where starting at login is supported. fn login_item(&self) -> Option<bool> { None@@ -86,6 +86,7 @@ ArtCraft Launcher is still running ArtCraft Launcher stále běží It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Je v oznamovací oblasti: otevřete ho nebo ukončete přes ikonu v ní, nebo to vypněte v nastavení. Show the window on the current desktop Zobrazit okno na aktuální ploše+ Hide the Dock icon while in the menu bar Skrýt ikonu v Docku při běhu na řádku nabídek Start ArtCraft Launcher when I log in Spouštět ArtCraft Launcher po přihlášení Community Komunita Questions, ideas and news from the ArtCraft team Dotazy, nápady a novinky od týmu ArtCraft@@ -237,6 +238,7 @@ month Dec 12. {count} updates are available Počet dostupných aktualizací: {count} These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Tyto poznámky se nepodařilo načíst (byl dosažen limit požadavků GitHubu). Najdete je na stránce vydání. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Je-li tato volba zapnutá, otevření launcheru z řádku nabídek zobrazí jeho okno na aktuální ploše. Je-li vypnutá, macOS přepne na plochu, na které se okno nacházelo.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Je-li tato volba zapnutá, po zavření okna zmizí ArtCraft Launcher z Docku a dál běží z řádku nabídek. Ikona v Docku se vrátí, když okno otevřete. Couldn't change the login item: {e} Položku po přihlášení nelze změnit: {e} column App Aplikace column Installed Nainstalováno@@ -99,6 +99,7 @@ ArtCraft Launcher is still running ArtCraft Launcher läuft weiter It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Er ist im Infobereich: dort über das Symbol öffnen oder beenden, oder das in den Einstellungen abschalten. Show the window on the current desktop Fenster auf dem aktuellen Schreibtisch zeigen+ Hide the Dock icon while in the menu bar Dock-Symbol ausblenden, solange nur die Menüleiste aktiv ist Start ArtCraft Launcher when I log in ArtCraft Launcher bei der Anmeldung starten Community Community Questions, ideas and news from the ArtCraft team Fragen, Ideen und Neuigkeiten vom ArtCraft-Team@@ -256,6 +257,7 @@ month Dec Dez. {count} updates are available {count} Updates sind verfügbar These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Diese Hinweise wurden nicht geladen (das Anfragelimit von GitHub ist erreicht). Sie stehen auf der Release-Seite. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Wenn aktiv, holt das Öffnen des Launchers aus der Menüleiste sein Fenster auf den Schreibtisch, auf dem du gerade bist. Wenn nicht, wechselt macOS zu dem Schreibtisch, auf dem das Fenster war.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Wenn aktiviert, verschwindet ArtCraft Launcher beim Schließen des Fensters aus dem Dock und läuft in der Menüleiste weiter. Beim Öffnen des Fensters kehrt das Dock-Symbol zurück. Couldn't change the login item: {e} Das Anmeldeobjekt konnte nicht geändert werden: {e} # Contextual: table column headers@@ -99,6 +99,7 @@ ArtCraft Launcher is still running ArtCraft Launcher sigue abierto It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Está en la bandeja del sistema: ábrelo o ciérralo desde su icono, o desactiva esto en los ajustes. Show the window on the current desktop Mostrar la ventana en el escritorio actual+ Hide the Dock icon while in the menu bar Ocultar el icono del Dock mientras está en la barra de menús Start ArtCraft Launcher when I log in Abrir ArtCraft Launcher al iniciar sesión Community Comunidad Questions, ideas and news from the ArtCraft team Preguntas, ideas y noticias del equipo de ArtCraft@@ -250,6 +251,7 @@ month Dec dic. {count} updates are available Hay {count} actualizaciones disponibles These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Estas notas no se descargaron (se alcanzó el límite de solicitudes de GitHub). Están en la página de la versión. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Si está activado, abrir ArtCraft Launcher desde la barra de menús lleva su ventana al escritorio en el que estás. Si está desactivado, macOS te cambia al escritorio en el que estaba la ventana.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Si está activado, al cerrar la ventana ArtCraft Launcher sale del Dock y sigue funcionando desde la barra de menús. El icono del Dock vuelve al abrir la ventana. Couldn't change the login item: {e} No se pudo cambiar el elemento de inicio de sesión: {e} column App Aplicación column Installed Instalada@@ -97,6 +97,7 @@ ArtCraft Launcher is still running ArtCraft Launcher est toujours en cours It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Il est dans la zone de notification : ouvrez-le ou quittez-le depuis son icône, ou désactivez ceci dans les réglages. Show the window on the current desktop Afficher la fenêtre sur le bureau actuel+ Hide the Dock icon while in the menu bar Masquer l'icône du Dock pendant le fonctionnement dans la barre des menus Start ArtCraft Launcher when I log in Lancer ArtCraft Launcher à l'ouverture de session Community Communauté Questions, ideas and news from the ArtCraft team Questions, idées et actualités de l'équipe ArtCraft@@ -254,6 +255,7 @@ month Dec déc. {count} updates are available {count} mises à jour sont disponibles These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Ces notes n'ont pas pu être récupérées (la limite de requêtes de GitHub a été atteinte). Elles sont sur la page de la version. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Si cette option est activée, ouvrir le launcher depuis la barre des menus amène sa fenêtre sur le bureau où vous êtes. Sinon, macOS vous renvoie sur le bureau où se trouvait la fenêtre.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Si cette option est activée, fermer la fenêtre retire ArtCraft Launcher du Dock et il continue de fonctionner depuis la barre des menus. L'icône du Dock revient à l’ouverture de la fenêtre. Couldn't change the login item: {e} Impossible de modifier l'élément d'ouverture de session : {e} # Contextual: table column headers@@ -99,6 +99,7 @@ ArtCraft Launcher is still running Az ArtCraft Launcher továbbra is fut It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. A tálcára került: az ikonjáról megnyitható vagy bezárható, vagy kapcsolja ki ezt a beállításokban. Show the window on the current desktop Ablak megjelenítése az aktuális asztalon+ Hide the Dock icon while in the menu bar Dock-ikon elrejtése, amíg a menüsorban fut Start ArtCraft Launcher when I log in ArtCraft Launcher indítása bejelentkezéskor Community Közösség Questions, ideas and news from the ArtCraft team Kérdések, ötletek és hírek az ArtCraft csapatától@@ -257,6 +258,7 @@ month Dec dec. {count} updates are available {count} frissítés elérhető These notes weren't fetched (GitHub's request limit was reached). They're on the release page. A kiadási információkat nem sikerült betölteni, mert elértük a GitHub lekérdezési korlátját. A kiadás oldalán megtalálod őket. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Ha be van kapcsolva, a menüsorból megnyitott ArtCraft Launcher ablaka az aktuális asztalon jelenik meg. Ha ki van kapcsolva, a macOS arra az asztalra vált, ahol az ablak található.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Ha be van kapcsolva, az ablak bezárásakor az ArtCraft Launcher eltűnik a Dockból, és a menüsorból fut tovább. A Dock-ikon az ablak megnyitásakor visszatér. Couldn't change the login item: {e} Az automatikus indítás beállítását nem sikerült módosítani: {e} # Contextual: table column headers@@ -101,6 +101,7 @@ ArtCraft Launcher is still running ArtCraft Launcher は実行中です It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. トレイに入りました。トレイのアイコンから開くか終了できます。設定でこの動作を無効にすることもできます。 Show the window on the current desktop 現在のデスクトップにウィンドウを表示+ Hide the Dock icon while in the menu bar メニューバーで実行中はDockのアイコンを隠す Start ArtCraft Launcher when I log in ログイン時に ArtCraft Launcher を起動 Community コミュニティ Questions, ideas and news from the ArtCraft team ArtCraft チームからの質問、アイデア、ニュース@@ -259,6 +260,7 @@ month Dec 12月 {count} updates are available {count} 件の更新があります These notes weren't fetched (GitHub's request limit was reached). They're on the release page. このリリースノートは取得できませんでした(GitHub のリクエスト上限に達しました)。リリースページにあります。 When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. オンにすると、メニューバーからランチャーを開いたときにウィンドウが現在のデスクトップに表示されます。オフにすると、macOS はウィンドウがあったデスクトップに切り替えます。+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. オンにすると、ウィンドウを閉じたときにArtCraft LauncherがDockから消え、メニューバーで実行を続けます。ウィンドウを開くとDockのアイコンが戻ります。 Couldn't change the login item: {e} ログイン項目を変更できませんでした: {e} # Contextual: table column headers@@ -100,6 +100,7 @@ ArtCraft Launcher is still running ArtCraft Launcher nadal działa It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Jest w zasobniku systemowym: otwórz go lub zamknij z jego ikony, albo wyłącz to w ustawieniach. Show the window on the current desktop Pokaż okno na bieżącym pulpicie+ Hide the Dock icon while in the menu bar Ukrywaj ikonę w Docku podczas działania na pasku menu Start ArtCraft Launcher when I log in Uruchom ArtCraft Launcher po zalogowaniu Community Społeczność Questions, ideas and news from the ArtCraft team Pytania, pomysły i nowości od zespołu ArtCraft@@ -258,6 +259,7 @@ month Dec gru {count} updates are available Dostępne aktualizacje: {count} These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Nie udało się pobrać tych notatek (osiągnięto limit zapytań GitHuba). Znajdziesz je na stronie wydania. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Gdy włączone, otwarcie launchera z paska menu przenosi jego okno na bieżący pulpit. Gdy wyłączone, macOS przełącza cię na pulpit, na którym było okno.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Gdy włączone, zamknięcie okna usuwa ArtCraft Launcher z Docka, a program działa dalej na pasku menu. Ikona w Docku wraca po otwarciu okna. Couldn't change the login item: {e} Nie udało się zmienić elementu logowania: {e} # Contextual: table column headers@@ -87,6 +87,7 @@ ArtCraft Launcher is still running O ArtCraft Launcher continua aberto It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Ele está na bandeja do sistema: abra-o ou encerre-o pelo ícone, ou desative isso nas configurações. Show the window on the current desktop Mostrar a janela na área de trabalho atual+ Hide the Dock icon while in the menu bar Ocultar o ícone do Dock enquanto estiver na barra de menus Start ArtCraft Launcher when I log in Iniciar o ArtCraft Launcher ao fazer login Community Comunidade Questions, ideas and news from the ArtCraft team Dúvidas, ideias e novidades da equipe ArtCraft@@ -244,6 +245,7 @@ month Dec dez. {count} updates are available {count} atualizações estão disponíveis These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Estas notas não foram carregadas (o limite de requisições do GitHub foi atingido). Elas estão na página de lançamentos. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Quando ativado, abrir o launcher pela barra de menus traz a janela para a área de trabalho atual. Quando desativado, o macOS alterna para a área de trabalho onde a janela estava.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Quando ativado, fechar a janela tira o ArtCraft Launcher do Dock e ele continua rodando pela barra de menus. O ícone do Dock volta quando você abre a janela. Couldn't change the login item: {e} Não foi possível alterar o item de inicialização no login: {e} # Contextual: table column headers@@ -97,6 +97,7 @@ ArtCraft Launcher is still running ArtCraft Launcher продолжает работать It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. Он в трее: откройте или закройте его через значок в трее, либо отключите это в настройках. Show the window on the current desktop Показывать окно на текущем рабочем столе+ Hide the Dock icon while in the menu bar Скрывать значок в Dock, пока приложение в строке меню Start ArtCraft Launcher when I log in Запускать ArtCraft Launcher при входе в систему Community Сообщество Questions, ideas and news from the ArtCraft team Вопросы, идеи и новости от команды ArtCraft@@ -253,6 +254,7 @@ month Dec дек. {count} updates are available Доступны обновления ({count}) These notes weren't fetched (GitHub's request limit was reached). They're on the release page. Заметки не были загружены (достигнут лимит запросов GitHub). Они есть на странице релиза. When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. Когда включено, открытие лаунчера из строки меню переносит его окно на текущий рабочий стол. Когда выключено, macOS переключает вас на рабочий стол, где находилось окно.+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. Когда включено, после закрытия окна ArtCraft Launcher пропадает из Dock и продолжает работать в строке меню. Значок в Dock возвращается при открытии окна. Couldn't change the login item: {e} Не удалось изменить пункт автозагрузки: {e} # Contextual: table column headers@@ -81,6 +81,7 @@ ArtCraft Launcher is still running ArtCraft Launcher 仍在运行 It's in the tray: open it or quit it from the tray icon, or turn this off in the settings. 它已进入系统托盘:可通过托盘图标打开或退出,也可在设置中关闭此行为。 Show the window on the current desktop 在当前桌面显示窗口+ Hide the Dock icon while in the menu bar 在菜单栏中运行时隐藏程序坞图标 Start ArtCraft Launcher when I log in 登录时启动 ArtCraft Launcher Community 社区 Questions, ideas and news from the ArtCraft team 与 ArtCraft 团队交流问题、想法和动态@@ -172,6 +173,7 @@ month Dec 12月 {count} updates are available 有 {count} 个可用更新 These notes weren't fetched (GitHub's request limit was reached). They're on the release page. 未能获取更新说明(已达到 GitHub 请求上限)。可前往版本发布页面查看。 When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on. 开启后,从菜单栏打开启动器时,窗口会显示在当前桌面。关闭后,macOS 会切换到窗口原来所在的桌面。+ When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window. 开启后,关闭窗口时 ArtCraft Launcher 会从程序坞中移除,并继续在菜单栏中运行。打开窗口后,程序坞图标会重新出现。 Couldn't change the login item: {e} 无法更改登录启动项:{e} column App 应用 column Installed 已安装版本@@ -101,6 +101,9 @@ pub struct Settings { /// macOS: showing the window brings it to the current desktop (Space) instead of switching to /// the desktop it was on. pub show_on_current_desktop: bool,+ /// macOS: while the window is closed to the menu bar, the launcher leaves the Dock and the+ /// app switcher; opening the window brings its Dock icon back.+ pub hide_dock_icon_in_tray: bool, pub check_every: CheckEvery, /// Automatically download and install updates when found. #[serde(default)]@@ -193,6 +196,7 @@ impl Default for Settings { language: "auto".to_string(), close_to_tray: true, show_on_current_desktop: true,+ hide_dock_icon_in_tray: false, check_every: CheckEvery::Hour, auto_update: false, notify: true,@@ -268,6 +268,15 @@ impl LauncherUi { "When on, opening the launcher from the menu bar brings its window to the desktop you're on. When off, macOS switches you to the desktop the window was on." )); }+ if host.has_tray() && host.has_dock() {+ ui.add_enabled(+ self.settings.close_to_tray,+ egui::Checkbox::new(&mut self.settings.hide_dock_icon_in_tray, tl!("Hide the Dock icon while in the menu bar")),+ )+ .on_hover_text(tl!(+ "When on, closing the window takes ArtCraft Launcher out of the Dock and it keeps running from the menu bar. The Dock icon comes back when you open the window."+ ));+ } if let Some(mut on) = host.login_item() && ui.checkbox(&mut on, tl!("Start ArtCraft Launcher when I log in")).changed() && let Err(e) = host.set_login_item(on)@@ -1077,6 +1077,19 @@ fn the_current_desktop_setting_is_only_offered_where_the_os_has_desktops() { assert!(Settings::default().show_on_current_desktop); } +#[test]+fn the_dock_icon_setting_is_only_offered_where_the_os_has_a_dock() {+ // NoHost has no Dock (Windows, Linux, web): no setting.+ let (mut h, _) = harness(ViewMode::Grid, egui::Theme::Dark, true);+ h.run_steps(6);+ h.get_by_label("Settings").click();+ h.run_steps(4);+ assert!(h.query_by_label("Hide the Dock icon while in the menu bar").is_none());+ // Off by default: the launcher stays a normal Dock app unless the user asks (macOS shows it+ // in Settings, DesktopHost::has_dock).+ assert!(!Settings::default().hide_dock_icon_in_tray);+}+ #[test] fn feed_announcements_and_alerts_show_until_dismissed() { use artcraft_launcher_core::feed::Notice;