diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-12-18 10:27:41 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-12-18 10:27:41 +0400 |
| commit | d155f5cd6c1a8c6a6e2b7259a8b0cee3187941ac (patch) | |
| tree | d29fedf27113033258de572bc7e76d2e764817e6 | |
| parent | 74ff4f1903b03136bbe33f20834037b6586da270 (diff) | |
| download | niri-d155f5cd6c1a8c6a6e2b7259a8b0cee3187941ac.tar.gz niri-d155f5cd6c1a8c6a6e2b7259a8b0cee3187941ac.tar.bz2 niri-d155f5cd6c1a8c6a6e2b7259a8b0cee3187941ac.zip | |
Add a config flag to disable an output
| -rw-r--r-- | resources/default-config.kdl | 3 | ||||
| -rw-r--r-- | src/backend/tty.rs | 5 | ||||
| -rw-r--r-- | src/config.rs | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/resources/default-config.kdl b/resources/default-config.kdl index 81655dc3..3e10b34b 100644 --- a/resources/default-config.kdl +++ b/resources/default-config.kdl @@ -43,6 +43,9 @@ input { // The built-in laptop monitor is usually called "eDP-1". // Remember to uncommend the node by removing "/-"! /-output "eDP-1" { + // Uncomment this line to disable this output. + // off + // Scale is a floating-point number, but at the moment only integer values work. scale 2.0 diff --git a/src/backend/tty.rs b/src/backend/tty.rs index 381113dc..f091672f 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -431,6 +431,11 @@ impl Tty { .cloned() .unwrap_or_default(); + if config.off { + debug!("output is disabled in the config"); + return Ok(()); + } + let device = self .output_device .as_mut() diff --git a/src/config.rs b/src/config.rs index a9b60dc9..58580f94 100644 --- a/src/config.rs +++ b/src/config.rs @@ -120,6 +120,8 @@ pub struct Tablet { #[derive(knuffel::Decode, Debug, Clone, PartialEq)] pub struct Output { + #[knuffel(child)] + pub off: bool, #[knuffel(argument)] pub name: String, #[knuffel(child, unwrap(argument), default = 1.)] @@ -133,6 +135,7 @@ pub struct Output { impl Default for Output { fn default() -> Self { Self { + off: false, name: String::new(), scale: 1., position: None, @@ -624,6 +627,7 @@ mod tests { }, }, outputs: vec