diff options
| author | it-a-me <92066678+it-a-me@users.noreply.github.com> | 2024-07-02 01:21:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-02 01:21:07 -0700 |
| commit | 105938df0bffefaf09beb576e7b9b22f159ce5eb (patch) | |
| tree | 6553f2aa5da8ae266ec59ba0218dc018bcc576c3 | |
| parent | 7b6fa1285475896ad8dbc2f4b11099b0c036e4b7 (diff) | |
| download | niri-105938df0bffefaf09beb576e7b9b22f159ce5eb.tar.gz niri-105938df0bffefaf09beb576e7b9b22f159ce5eb.tar.bz2 niri-105938df0bffefaf09beb576e7b9b22f159ce5eb.zip | |
Keep monitors powered off upon connecting a new one (#488)
* Keep monitors powered off upon connecting a new one
Update src/backend/tty.rs
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
Update src/backend/tty.rs
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
fix tests
* Update
---------
Co-authored-by: Ivan Molodetskikh <yalterz@gmail.com>
| -rw-r--r-- | src/backend/tty.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/tty.rs b/src/backend/tty.rs index ff806723..54fc97c1 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -965,16 +965,22 @@ impl Tty { presentation_misprediction_plot_name, sequence_delta_plot_name, }; + let res = device.surfaces.insert(crtc, surface); assert!(res.is_none(), "crtc must not have already existed"); niri.add_output(output.clone(), Some(refresh_interval(mode)), vrr_enabled); - // Power on all monitors if necessary and queue a redraw on the new one. - niri.event_loop.insert_idle(move |state| { - state.niri.activate_monitors(&mut state.backend); - state.niri.queue_redraw(&output); - }); + // Some buggy monitors replug upon powering off, so powering on here would prevent such + // monitors from powering off. Therefore, we avoid unconditionally powering on. + if niri.monitors_active { + // Redraw the new monitor. + niri.event_loop.insert_idle(move |state| { + state.niri.queue_redraw(&output); + }); + } else { + set_crtc_active(&device.drm, crtc, false); + } Ok(()) } |
