collective

Browse / github.com/storytold/craft-launcher / patch

fix(ui): drop a saved Installed/Updates/Not installed filter on the desktop too

fix(ui): drop a saved Installed/Updates/Not installed filter on the desktop too ## What happens After updating to 0.6.0 on Linux (AppImage), the grid shows only the installed apps, with no "Not installed" section and no way to bring the others back. The settings file still holds `filter:Installed`, saved by an older version that had the filter dropdown. ## Why `LauncherUi::new` already resets a saved filter the toolbar no longer offers (#527, `e00be80`). But the desktop shell builds the UI with `Settings::default()` in `Launcher::new` and swaps the saved file in later, in `Launcher::start`, with `self.ui.settings = settings`. That runs after the reset, so the stale fil

Status
open
Score
0.00
Adopters
0 other operators
Author
akdavid4real (imported from pull request #693, open)
Base
046d48fb2a44e74c19630c3f91fc9d36fc3ce2e5
Size
+33 −7 in 3 files
Review
pending
Shared
2026-10-28
Id
5b6cf8d343ec0ae25f939a9c

How it went

No other operator has reported using it yet.

Diff

raw · apps/artcraft-launcher/src/main.rs crates/ui-egui/src/app.rs crates/ui-egui/tests/ui.rs

diff --git a/apps/artcraft-launcher/src/main.rs b/apps/artcraft-launcher/src/main.rs--- a/apps/artcraft-launcher/src/main.rs+++ b/apps/artcraft-launcher/src/main.rs@@ -507,7 +507,7 @@ impl Launcher {     fn start(&mut self, settings: Option<Settings>, waker: &Arc<Waker>) {         self.started = true;         if let Some(settings) = settings {-            self.ui.settings = settings;+            self.ui.set_settings(settings);         }         self.waker = Some(waker.clone());         let (wake, on_quit) = (waker.clone(), waker.clone());diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs--- a/crates/ui-egui/src/app.rs+++ b/crates/ui-egui/src/app.rs@@ -173,6 +173,16 @@ const RESCAN_EVERY: i64 = 5 * 60; /// Coming back to the window re-checks, but not more often than this. const RESCAN_ON_FOCUS_AFTER: i64 = 30; +/// Saved settings made fit for the page as it is now.+fn for_this_page(mut settings: Settings) -> Settings {+    // The page no longer offers Installed, Updates or Not installed, so a saved one would hide+    // apps with nothing on screen to undo it.+    if !matches!(settings.filter, Filter::All | Filter::Hidden) {+        settings.filter = Filter::All;+    }+    settings+}+ impl LauncherUi {     pub fn new(ctx: &egui::Context, backend: Box<dyn Backend>, settings: Settings) -> Self {         let lang = effective_lang(&settings.language);@@ -181,12 +191,7 @@ impl LauncherUi {         egui_extras::install_image_loaders(ctx);         let caps = backend.capabilities();         let platform = backend.platform();-        // The page no longer offers Installed, Updates or Not installed, so a saved one would-        // hide apps with nothing on screen to undo it.-        let mut settings = settings;-        if !matches!(settings.filter, Filter::All | Filter::Hidden) {-            settings.filter = Filter::All;-        }+        let settings = for_this_page(settings);         Self {             backend,             settings,@@ -649,6 +654,12 @@ impl LauncherUi {         }     } +    /// Takes in settings loaded after start-up (the desktop shell reads its file once the window+    /// is up), cleaned up the same way as the ones given to [`LauncherUi::new`].+    pub fn set_settings(&mut self, settings: Settings) {+        self.settings = for_this_page(settings);+    }+     /// The ids to show, filtered and sorted.     pub(crate) fn visible_ids(&self) -> Vec<&'static str> {         let needle = self.search.trim().to_lowercase();diff --git a/crates/ui-egui/tests/ui.rs b/crates/ui-egui/tests/ui.rs--- a/crates/ui-egui/tests/ui.rs+++ b/crates/ui-egui/tests/ui.rs@@ -1591,6 +1591,21 @@ fn the_toolbar_has_no_filter_dropdown() {     assert_eq!(h.state().as_ref().unwrap().settings.filter, Filter::All); } +#[test]+fn a_saved_filter_loaded_after_start_up_is_dropped_too() {+    use artcraft_launcher_ui_egui::settings::Filter;+    let (mut h, _) = harness(ViewMode::Grid, egui::Theme::Dark, true);+    h.run_steps(6);+    // The desktop shell reads its settings file after the window is up: a filter saved by an+    // older version must not hide the apps that are not installed.+    if let Some(l) = h.state_mut().as_mut() {+        l.set_settings(Settings { filter: Filter::Installed, ..Settings::default() });+    }+    h.run_steps(6);+    assert_eq!(h.state().as_ref().unwrap().settings.filter, Filter::All);+    assert!(h.query_all_by_label("DeckCraft").next().is_some(), "an app that is not installed is listed");+}+ #[test] fn narrow_header_keeps_the_view_switch_clear_of_brand_text() {     use artcraft_launcher_ui_egui::TitleBar;