Commit 0f513a2420c0
tarball1 file changed+14-2
@@ -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
}