Skip to content

Commit 0c07853

Browse files
committed
config: Don't error if tiling_exception_custom is not present
As noted in pop-os/cosmic-comp#1603, there's no need to a system default config file for this particular setting. So as an alternative to that PR, we can ensure this isn't printed as an error. As noted in the description of pop-os/libcosmic#948, if the system default is not present, `Error::GetKey` is returned, without mapping to the `Error::NotFound` variant. So check for that, as well as `.is_err()`.
1 parent 6a633c5 commit 0c07853

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

config/src/window_rules/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ pub fn tiling_exceptions(context: &cosmic_config::Config) -> Vec<ApplicationExce
7777
let custom = context
7878
.get::<Vec<PreciseApplicationException>>("tiling_exception_custom")
7979
.unwrap_or_else(|why| {
80-
tracing::error!("tiling exceptions custom config error: {why:?}");
80+
if why.is_err() {
81+
if let cosmic_config::Error::GetKey(_, err) = &why {
82+
if err.kind() != std::io::ErrorKind::NotFound {
83+
tracing::error!("tiling exceptions custom config error: {why}");
84+
return Vec::new();
85+
}
86+
}
87+
}
88+
tracing::debug!("tiling exceptions custom config not present: {why}");
8189
Vec::new()
8290
});
8391

0 commit comments

Comments
 (0)