From 0fb2611a4c48b5d5079b864fd7e72776e346b47e Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Wed, 22 May 2024 15:41:07 -0400 Subject: [PATCH] fix(wallpaper): Avoid resetting unlisted wallpaper settings --- .../src/pages/desktop/wallpaper/mod.rs | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/cosmic-settings/src/pages/desktop/wallpaper/mod.rs b/cosmic-settings/src/pages/desktop/wallpaper/mod.rs index c9d0718..59f3a2f 100644 --- a/cosmic-settings/src/pages/desktop/wallpaper/mod.rs +++ b/cosmic-settings/src/pages/desktop/wallpaper/mod.rs @@ -624,11 +624,28 @@ impl Page { FIT => ScalingMode::Fit([0.0, 0.0, 0.0]), _ => return None, }; + let old_entry = if output == "all" { + Some(&self.wallpaper_service_config.default_background) + } else { + self.wallpaper_service_config + .backgrounds + .iter() + .find(|entry| entry.output == output) + }; - Entry::new(output, wallpaper::Source::Path(path)) + let entry = Entry::new(output, wallpaper::Source::Path(path)) .scaling_mode(scaling_mode) - .rotation_frequency(self.rotation_frequency) - .apply(Some) + .rotation_frequency(self.rotation_frequency); + + if let Some(old_entry) = old_entry { + entry + .sampling_method(old_entry.sampling_method) + .filter_method(old_entry.filter_method.clone()) + .filter_by_theme(old_entry.filter_by_theme) + } else { + entry + } + .apply(Some) } #[must_use]