forge
Explore
Log in

Don't you dare go Hollow

Add a config flag to disable an output

Browse files at this commit

d155f5cd6c1a8c6a6e2b7259a8b0cee3187941acIvan MolodetskikhParent: 74ff4f1
resources/default-config.kdlmodified+3 -0
@@ -43,6 +43,9 @@ input {
4343 // The built-in laptop monitor is usually called "eDP-1".
4444 // Remember to uncommend the node by removing "/-"!
4545 /-output "eDP-1" {
46+ // Uncomment this line to disable this output.
47+ // off
48+
4649 // Scale is a floating-point number, but at the moment only integer values work.
4750 scale 2.0
4851
src/backend/tty.rsmodified+5 -0
@@ -431,6 +431,11 @@ impl Tty {
431431 .cloned()
432432 .unwrap_or_default();
433433
434+ if config.off {
435+ debug!("output is disabled in the config");
436+ return Ok(());
437+ }
438+
434439 let device = self
435440 .output_device
436441 .as_mut()
src/config.rsmodified+4 -0
@@ -120,6 +120,8 @@ pub struct Tablet {
120120
121121 #[derive(knuffel::Decode, Debug, Clone, PartialEq)]
122122 pub struct Output {
123+ #[knuffel(child)]
124+ pub off: bool,
123125 #[knuffel(argument)]
124126 pub name: String,
125127 #[knuffel(child, unwrap(argument), default = 1.)]
@@ -133,6 +135,7 @@ pub struct Output {
133135 impl Default for Output {
134136 fn default() -> Self {
135137 Self {
138+ off: false,
136139 name: String::new(),
137140 scale: 1.,
138141 position: None,
@@ -624,6 +627,7 @@ mod tests {
624627 },
625628 },
626629 outputs: vec![Output {
630+ off: false,
627631 name: "eDP-1".to_owned(),
628632 scale: 2.,
629633 position: Some(Position { x: 10, y: 20 }),