Update desktop configs cached in locations, fixes #608

This commit is contained in:
Jeremy Soller 2024-11-15 08:03:06 -07:00
parent f6ce791c4c
commit d0f0da2eef
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
2 changed files with 10 additions and 3 deletions

View file

@ -859,13 +859,19 @@ impl App {
let mut needs_reload = Vec::new();
for entity in self.tab_model.iter() {
if let Some(tab) = self.tab_model.data::<Tab>(entity) {
if let Location::Desktop(..) = &tab.location {
needs_reload.push((entity, tab.location.clone()));
if let Location::Desktop(path, output, _) = &tab.location {
needs_reload.push((
entity,
Location::Desktop(path.clone(), output.clone(), self.config.desktop),
));
};
}
}
let mut commands = Vec::with_capacity(needs_reload.len());
for (entity, location) in needs_reload {
if let Some(tab) = self.tab_model.data_mut::<Tab>(entity) {
tab.location = location.clone();
}
commands.push(self.rescan_tab(entity, location, None));
}
Task::batch(commands)

View file

@ -68,11 +68,12 @@ pub fn desktop() -> Result<(), Box<dyn std::error::Error>> {
settings = settings.no_main_window(true);
}
let locations = vec![tab::Location::Desktop(desktop_dir(), String::new(), config.desktop)];
let flags = Flags {
config_handler,
config,
mode: app::Mode::Desktop,
locations: vec![tab::Location::Path(desktop_dir())],
locations,
};
cosmic::app::run::<App>(settings, flags)?;