mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Add a config flag to disable an output
This commit is contained in:
@@ -43,6 +43,9 @@ input {
|
|||||||
// The built-in laptop monitor is usually called "eDP-1".
|
// The built-in laptop monitor is usually called "eDP-1".
|
||||||
// Remember to uncommend the node by removing "/-"!
|
// Remember to uncommend the node by removing "/-"!
|
||||||
/-output "eDP-1" {
|
/-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 is a floating-point number, but at the moment only integer values work.
|
||||||
scale 2.0
|
scale 2.0
|
||||||
|
|
||||||
|
|||||||
@@ -431,6 +431,11 @@ impl Tty {
|
|||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
if config.off {
|
||||||
|
debug!("output is disabled in the config");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let device = self
|
let device = self
|
||||||
.output_device
|
.output_device
|
||||||
.as_mut()
|
.as_mut()
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ pub struct Tablet {
|
|||||||
|
|
||||||
#[derive(knuffel::Decode, Debug, Clone, PartialEq)]
|
#[derive(knuffel::Decode, Debug, Clone, PartialEq)]
|
||||||
pub struct Output {
|
pub struct Output {
|
||||||
|
#[knuffel(child)]
|
||||||
|
pub off: bool,
|
||||||
#[knuffel(argument)]
|
#[knuffel(argument)]
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[knuffel(child, unwrap(argument), default = 1.)]
|
#[knuffel(child, unwrap(argument), default = 1.)]
|
||||||
@@ -133,6 +135,7 @@ pub struct Output {
|
|||||||
impl Default for Output {
|
impl Default for Output {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
off: false,
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
scale: 1.,
|
scale: 1.,
|
||||||
position: None,
|
position: None,
|
||||||
@@ -624,6 +627,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
outputs: vec![Output {
|
outputs: vec![Output {
|
||||||
|
off: false,
|
||||||
name: "eDP-1".to_owned(),
|
name: "eDP-1".to_owned(),
|
||||||
scale: 2.,
|
scale: 2.,
|
||||||
position: Some(Position { x: 10, y: 20 }),
|
position: Some(Position { x: 10, y: 20 }),
|
||||||
|
|||||||
Reference in New Issue
Block a user