mirror of
https://github.com/YaLTeR/niri.git
synced 2024-10-03 23:43:26 +03:00
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>
This commit is contained in:
parent
7b6fa12854
commit
105938df0b
@ -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(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user