fix(wallpapers): displays not being shown when lacking custom images

This commit is contained in:
Michael Aaron Murphy 2024-06-04 08:29:58 +02:00
parent 20a6554002
commit 17a74a512b
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -434,7 +434,7 @@ impl Page {
if self.wallpaper_service_config.same_on_all {
self.wallpaper_service_config.backgrounds.clear();
self.wallpaper_service_config.outputs.clear();
// self.wallpaper_service_config.outputs.clear();
} else if let Some(pos) = self
.wallpaper_service_config
.backgrounds
@ -938,14 +938,20 @@ impl Page {
}
// These will need to be loaded before applying the service config.
let custom_images = self.config.custom_images();
let custom_images = self.config.custom_images().len();
// Make note of how many images are to be loaded, with the display update for the service config.
self.update_config = Some((custom_images.len(), update.displays));
if custom_images == 0 {
self.wallpaper_service_config_update(update.displays);
self.config_apply();
} else {
// Make note of how many images are to be loaded, with the display update for the service config.
self.update_config = Some((custom_images, update.displays));
}
// Load preview images concurrently for each custom image stored in the on-disk config.
return cosmic::command::batch(
custom_images
self.config
.custom_images()
.iter()
.cloned()
.map(|path| {
@ -1163,14 +1169,13 @@ pub fn settings() -> Section<crate::pages::Message> {
let mut slideshow_enabled = page
.config_output()
.and_then(|output| page.wallpaper_service_config.entry(output))
.map(|entry| {
.map_or(false, |entry| {
if let Source::Path(path) = &entry.source {
path.is_dir()
} else {
false
}
})
.unwrap_or(false);
});
children.push(crate::widget::display_container(
match page.selection.active {