diff --git a/apps/artcraft-launcher/src/main.rs b/apps/artcraft-launcher/src/main.rs index c1dcdf19..556fd948 100644 --- a/apps/artcraft-launcher/src/main.rs +++ b/apps/artcraft-launcher/src/main.rs @@ -790,10 +790,14 @@ impl eframe::App for Shell<'_> { if ctx.input(|i| i.viewport().close_requested()) && !self.quitting && !self.launcher.closed_to_tray { match on_close(self.launcher.tray.is_some(), self.launcher.ui.settings.close_to_tray, self.window_hides) { OnClose::Hide => { + self.launcher.ui.hidden_to_tray(&mut self.launcher.host); ctx.send_viewport_cmd(egui::ViewportCommand::CancelClose); self.put_away(ctx); } - OnClose::ToTray => self.launcher.closed_to_tray = true, + OnClose::ToTray => { + self.launcher.ui.hidden_to_tray(&mut self.launcher.host); + self.launcher.closed_to_tray = true; + } OnClose::Quit => {} } } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 18c2bf7e..d5ab6670 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -520,6 +520,20 @@ impl LauncherUi { } } + /// The user closed the window and it went away in the tray. The first time, a notification + /// says so, with where to find it and how to quit: a window that vanishes with nothing to show + /// for it looks hung (#45, #215). + pub fn hidden_to_tray(&mut self, host: &mut dyn Host) { + if self.settings.tray_hint_shown { + return; + } + self.settings.tray_hint_shown = true; + host.notify( + tl!("ArtCraft Launcher is still running"), + tl!("It's in the tray: open it or quit it from the tray icon, or turn this off in the settings."), + ); + } + /// When auto-updates are enabled, automatically downloads and installs pending updates. pub(crate) fn trigger_auto_updates(&mut self) { if !self.caps.manage_apps || !self.settings.auto_update { diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 8be87a74..734feae9 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -83,6 +83,8 @@ Updates always use the format an app was installed with. Aktualizace vždy použijí formát, ve kterém byla aplikace nainstalována. Running in the background Běh na pozadí Keep running in the tray when the window is closed Po zavření okna ponechat spuštěné v oznamovací oblasti + 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 Start ArtCraft Launcher when I log in Spouštět ArtCraft Launcher po přihlášení Community Komunita diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 8922120a..818f1d13 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -96,6 +96,8 @@ Updates always use the format an app was installed with. Updates verwenden immer das Format, mit dem eine App installiert wurde. Running in the background Im Hintergrund ausführen Keep running in the tray when the window is closed Beim Schließen des Fensters im Infobereich weiterlaufen + 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 Start ArtCraft Launcher when I log in ArtCraft Launcher bei der Anmeldung starten Community Community diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 31efb0b1..e49ea55d 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -96,6 +96,8 @@ Updates always use the format an app was installed with. Las actualizaciones siempre usan el formato con el que se instaló cada aplicación. Running in the background En segundo plano Keep running in the tray when the window is closed Seguir abierto en la bandeja del sistema al cerrar la ventana + 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 Start ArtCraft Launcher when I log in Abrir ArtCraft Launcher al iniciar sesión Community Comunidad diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 13300d2a..635974f2 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -94,6 +94,8 @@ Updates always use the format an app was installed with. Les mises à jour utilisent toujours le format avec lequel l'application a été installée. Running in the background Exécution en arrière-plan Keep running in the tray when the window is closed Rester actif dans la zone de notification à la fermeture de la fenêtre + 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 Start ArtCraft Launcher when I log in Lancer ArtCraft Launcher à l'ouverture de session Community Communauté diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 3dae1b52..d25bd5ba 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -96,6 +96,8 @@ Updates always use the format an app was installed with. A frissítések mindig az eredeti telepítés csomagformátumát használják. Running in the background Futtatás a háttérben Keep running in the tray when the window is closed Az ablak bezárásakor kerüljön a tálcára + 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 Start ArtCraft Launcher when I log in ArtCraft Launcher indítása bejelentkezéskor Community Közösség diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index eafe2c9f..2c08acb0 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -98,6 +98,8 @@ Updates always use the format an app was installed with. 更新は常に、アプリをインストールしたときの形式で行われます。 Running in the background バックグラウンドで実行 Keep running in the tray when the window is closed ウィンドウを閉じてもトレイで実行し続ける + 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 現在のデスクトップにウィンドウを表示 Start ArtCraft Launcher when I log in ログイン時に ArtCraft Launcher を起動 Community コミュニティ diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index b12112c3..bc95769b 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -97,6 +97,8 @@ Updates always use the format an app was installed with. Aktualizacje zawsze używają formatu, w jakim pierwotnie zainstalowano aplikację. Running in the background Działanie w tle Keep running in the tray when the window is closed Po zamknięciu okna działaj w zasobniku systemowym + 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 Start ArtCraft Launcher when I log in Uruchom ArtCraft Launcher po zalogowaniu Community Społeczność diff --git a/crates/ui-egui/src/i18n/pt-BR.tsv b/crates/ui-egui/src/i18n/pt-BR.tsv index c185c19a..2081977c 100644 --- a/crates/ui-egui/src/i18n/pt-BR.tsv +++ b/crates/ui-egui/src/i18n/pt-BR.tsv @@ -84,6 +84,8 @@ Updates always use the format an app was installed with. As atualizações sempre usam o formato com o qual o aplicativo foi instalado. Running in the background Execução em segundo plano Keep running in the tray when the window is closed Continuar na bandeja do sistema ao fechar a janela + 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 Start ArtCraft Launcher when I log in Iniciar o ArtCraft Launcher ao fazer login Community Comunidade diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 7df8058b..94de7563 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -94,6 +94,8 @@ Updates always use the format an app was installed with. Обновления всегда используют формат, с которым приложение было установлено. Running in the background Работа в фоне Keep running in the tray when the window is closed Оставаться в трее при закрытии окна + 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 Показывать окно на текущем рабочем столе Start ArtCraft Launcher when I log in Запускать ArtCraft Launcher при входе в систему Community Сообщество diff --git a/crates/ui-egui/src/i18n/zh-CN.tsv b/crates/ui-egui/src/i18n/zh-CN.tsv index 7c14a6f2..4cdcb1f4 100644 --- a/crates/ui-egui/src/i18n/zh-CN.tsv +++ b/crates/ui-egui/src/i18n/zh-CN.tsv @@ -78,6 +78,8 @@ Updates always use the format an app was installed with. 更新时始终使用应用原来的安装格式。 Running in the background 后台运行 Keep running in the tray when the window is closed 关闭窗口后继续在系统托盘中运行 + 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 在当前桌面显示窗口 Start ArtCraft Launcher when I log in 登录时启动 ArtCraft Launcher Community 社区 diff --git a/crates/ui-egui/src/settings.rs b/crates/ui-egui/src/settings.rs index 75b644f7..fca30b6d 100644 --- a/crates/ui-egui/src/settings.rs +++ b/crates/ui-egui/src/settings.rs @@ -118,6 +118,8 @@ pub struct Settings { pub last_check: Option, /// Catalog ids of apps hidden from the main lists (`photocraft`, …). pub hidden: std::collections::BTreeSet, + /// The one-time notice that closing the window keeps the launcher in the tray has been shown. + pub tray_hint_shown: bool, /// How many times each app was opened from the launcher (catalog id → count), for "Frequently used". pub launches: BTreeMap, } @@ -200,6 +202,7 @@ impl Default for Settings { notified: BTreeMap::new(), last_check: None, hidden: std::collections::BTreeSet::new(), + tray_hint_shown: false, launches: BTreeMap::new(), } } diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rs index 565c972f..b9bdab73 100644 --- a/crates/ui-egui/tests/ui.rs +++ b/crates/ui-egui/tests/ui.rs @@ -802,6 +802,28 @@ fn every_table_column_sorts_both_ways() { assert_eq!(o.first().map(String::as_str), Some("WordCraft"), "{o:?}"); } +/// The first close to the tray is explained once, by a system notification (#45, #215). +#[test] +fn the_first_close_to_the_tray_is_explained_once() { + struct Notices(Vec<(String, String)>); + impl Host for Notices { + fn notify(&mut self, title: &str, body: &str) { + self.0.push((title.to_string(), body.to_string())); + } + } + let (mut h, _) = harness(ViewMode::Grid, egui::Theme::Dark, true); + h.run_steps(6); + let mut host = Notices(Vec::new()); + let l = h.state_mut().as_mut().unwrap(); + assert!(!l.settings.tray_hint_shown); + l.hidden_to_tray(&mut host); + l.hidden_to_tray(&mut host); + assert!(l.settings.tray_hint_shown); + assert_eq!(host.0.len(), 1, "{:?}", host.0); + assert_eq!(host.0[0].0, "ArtCraft Launcher is still running"); + assert!(host.0[0].1.contains("tray icon"), "{}", host.0[0].1); +} + #[test] fn settings_link_to_discord() { let (mut h, _) = harness(ViewMode::Grid, egui::Theme::Dark, true);