Add a config flag to disable an output

This commit is contained in:
Ivan Molodetskikh
2023-12-18 10:27:41 +04:00
parent 74ff4f1903
commit d155f5cd6c
3 changed files with 12 additions and 0 deletions
+3
View File
@@ -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
+5
View File
@@ -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()
+4
View File
@@ -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![Output {
off: false,
name: "eDP-1".to_owned(),
scale: 2.,
position: Some(Position { x: 10, y: 20 }),