Skip to content

Commit bb86c95

Browse files
committed
Don't error when default config for toolkit settings is not present
Like pop-os/cosmic-settings-daemon#100. We don't appear to install default configs for these settings anywhere? And we may not want libcosmic to inherently depend on globally installed config files. So just avoid printing errors in that case. We may want to consider what errors `ConfigGet` returns (#948) but this should do for now. This should help with a big part of the log spam libcosmic is currently producing.
1 parent 8415d77 commit bb86c95

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/app/cosmic.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ where
369369
.into_iter()
370370
.filter(cosmic_config::Error::is_err)
371371
{
372+
if let cosmic_config::Error::GetKey(_, err) = &why {
373+
if err.kind() == std::io::ErrorKind::NotFound {
374+
// No system default config installed; don't error
375+
continue;
376+
}
377+
}
372378
tracing::error!(?why, "cosmic toolkit config update error");
373379
}
374380

src/config/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ pub static COSMIC_TK: LazyLock<RwLock<CosmicTk>> = LazyLock::new(|| {
2525
.map(|c| {
2626
CosmicTk::get_entry(&c).unwrap_or_else(|(errors, mode)| {
2727
for why in errors.into_iter().filter(cosmic_config::Error::is_err) {
28+
if let cosmic_config::Error::GetKey(_, err) = &why {
29+
if err.kind() == std::io::ErrorKind::NotFound {
30+
// No system default config installed; don't error
31+
continue;
32+
}
33+
}
2834
tracing::error!(?why, "CosmicTk config entry error");
2935
}
3036
mode

0 commit comments

Comments
 (0)