diff --git a/src/blocks.rs b/src/blocks.rs index f00a294547..4cbc9df0f7 100644 --- a/src/blocks.rs +++ b/src/blocks.rs @@ -43,6 +43,8 @@ use crate::errors::*; use crate::widget::Widget; use crate::{BoxedFuture, Request, RequestCmd}; +use crate::util; + macro_rules! define_blocks { { $( @@ -135,7 +137,23 @@ macro_rules! define_blocks { ))), )? )* - other => Err(D::Error::custom(format!("unknown block '{other}'"))) + other => { + match util::find_file(other, Some("blocks"), Some("toml")) { + Some(file) => match util::deserialize_toml_file::(file) { + Ok(config) => { + if table.is_empty() { + Ok(config) + } else { + Err(D::Error::custom(format!("specifying additional options for {other} at location of inclusion is unsupported"))) + } + }, + Err(err) => Err(D::Error::custom(format!("error in block file '{other}': {err}"))) + } + None => { + Err(D::Error::custom(format!("unknown block '{other}'"))) + } + } + } } } } @@ -146,7 +164,7 @@ define_blocks!( amd_gpu, #[deprecated( since = "0.33.0", - note = "The block has been deprecated in favor of the the packages block" + note = "The block has been deprecated in favor of the packages block" )] apt, backlight, @@ -159,7 +177,7 @@ define_blocks!( disk_space, #[deprecated( since = "0.33.0", - note = "The block has been deprecated in favor of the the packages block" + note = "The block has been deprecated in favor of the packages block" )] dnf, docker, @@ -182,7 +200,7 @@ define_blocks!( packages, #[deprecated( since = "0.33.0", - note = "The block has been deprecated in favor of the the packages block" + note = "The block has been deprecated in favor of the packages block" )] pacman, pomodoro, diff --git a/src/blocks/hueshift.rs b/src/blocks/hueshift.rs index 9740016bff..9d3bd89b43 100644 --- a/src/blocks/hueshift.rs +++ b/src/blocks/hueshift.rs @@ -316,7 +316,7 @@ impl HueShiftDriver for Wlsunset { // night temp: 4000K // latitude/longitude: NaN // ^ results in sun_condition == POLAR_NIGHT at time of testing - // With these defaults, this results in the the color temperature + // With these defaults, this results in the color temperature // getting set to 4000K. spawn_process("pkill", &["wlsunset"]) .error("Failed to set new color temperature using wlsunset.")