atagen

monolith

public
Star0
Watch0

Commit 0f513a2420c0

tarball

atagen <boss@atagen.co>2026-10-18 02:53 UTC

1 file changed+14-2
config: warn on output sections that cannot name a connector

A section like [output.DP1] matched no connector and was ignored without a word, leaving the output unrotated with no hint why.
Modified file: crates/config/src/lib.rs+14 additions−2 deletions
@@ -396,7 +396,12 @@ impl Config {
396396 let keyboard = section("keyboard", table.remove("keyboard"), w);
397397 let animation = section("animation", table.remove("animation"), w);
398398 let decoration = section("decoration", table.remove("decoration"), w);
399- let output = section("output", table.remove("output"), w);
399+ let output: Outputs = section("output", table.remove("output"), w);
400+ for name in output.named.keys().filter(|n| !connector_like(n)) {
401+ w.push(format!(
402+ "output.{name}: not a connector name like DP-1 or HDMI-A-1, matches nothing"
403+ ));
404+ }
400405 let startup = items("startup", table.remove("startup"), w);
401406 let mut binds = Vec::new();
402407 if let Some(value) = table.remove("binds") {
@@ -513,6 +518,12 @@ fn entry<T: DeserializeOwned>(name: &str, value: toml::Value, w: &mut Vec<String
513518 .ok()
514519 }
515520
521+fn connector_like(name: &str) -> bool {
522+ name.rsplit_once('-').is_some_and(|(kind, n)| {
523+ !kind.is_empty() && !n.is_empty() && n.bytes().all(|b| b.is_ascii_digit())
524+ })
525+}
526+
516527 /// A section with every option that does not fit left at its default.
517528 fn section<T: DeserializeOwned + Default>(
518529 name: &str,
@@ -611,6 +622,7 @@ mod tests {
611622 position = [0, 0]
612623 [output.DP-2]
613624 transform = "sideways"
625+ [output.DP1]
614626 [[rules]]
615627 app_id = "("
616628 [[rules]]
@@ -627,6 +639,6 @@ mod tests {
627639 assert_eq!((c.binds.len(), c.rules.len()), (1, 1));
628640 assert_eq!(c.output.named["DP-1"].transform, OutputTransform::Rotate90);
629641 assert!(!c.output.named.contains_key("DP-2"));
630- assert_eq!(loaded.warnings.len(), 6, "{:#?}", loaded.warnings);
642+ assert_eq!(loaded.warnings.len(), 7, "{:#?}", loaded.warnings);
631643 }
632644 }