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 {
43 // The built-in laptop monitor is usually called "eDP-1".43 // The built-in laptop monitor is usually called "eDP-1".
44 // Remember to uncommend the node by removing "/-"!44 // Remember to uncommend the node by removing "/-"!
45 /-output "eDP-1" {45 /-output "eDP-1" {
46+ // Uncomment this line to disable this output.
47+ // off
48+
46 // Scale is a floating-point number, but at the moment only integer values work.49 // Scale is a floating-point number, but at the moment only integer values work.
47 scale 2.050 scale 2.0
48 51
src/backend/tty.rsmodified+5 -0
@@ -431,6 +431,11 @@ impl Tty {
431 .cloned()431 .cloned()
432 .unwrap_or_default();432 .unwrap_or_default();
433 433
434+ if config.off {
435+ debug!("output is disabled in the config");
436+ return Ok(());
437+ }
438+
434 let device = self439 let device = self
435 .output_device440 .output_device
436 .as_mut()441 .as_mut()
src/config.rsmodified+4 -0
@@ -120,6 +120,8 @@ pub struct Tablet {
120 120
121 #[derive(knuffel::Decode, Debug, Clone, PartialEq)]121 #[derive(knuffel::Decode, Debug, Clone, PartialEq)]
122 pub struct Output {122 pub struct Output {
123+ #[knuffel(child)]
124+ pub off: bool,
123 #[knuffel(argument)]125 #[knuffel(argument)]
124 pub name: String,126 pub name: String,
125 #[knuffel(child, unwrap(argument), default = 1.)]127 #[knuffel(child, unwrap(argument), default = 1.)]
@@ -133,6 +135,7 @@ pub struct Output {
133 impl Default for Output {135 impl Default for Output {
134 fn default() -> Self {136 fn default() -> Self {
135 Self {137 Self {
138+ off: false,
136 name: String::new(),139 name: String::new(),
137 scale: 1.,140 scale: 1.,
138 position: None,141 position: None,
@@ -624,6 +627,7 @@ mod tests {
624 },627 },
625 },628 },
626 outputs: vec![Output {629 outputs: vec![Output {
630+ off: false,
627 name: "eDP-1".to_owned(),631 name: "eDP-1".to_owned(),
628 scale: 2.,632 scale: 2.,
629 position: Some(Position { x: 10, y: 20 }),633 position: Some(Position { x: 10, y: 20 }),