config: Make read_outputs failable

Previously we ignored when we had no output configuration
**and** failed to apply the automatically created one.

This leads to two problems:
- If this happens on startup, we end up with no outputs being added to the shell and we quit.
- If this happens later, we might end up in an inconsistent state, where the shell thinks we have an output, when it didn't light up for similar reasons.

Thus `read_outputs` is failable and handling that very much depends on
the where is was called from, because `read_outputs` doesn't know what
configuration was active before.

Thus make it failable and provide useful mitigations everywhere
possible:
- Try to enable just one output in case we fail on startup.
- Don't enable any additional outputs, when we fail on hotplug.
- Log the error like previously in any other case (and come up with more
  mitigations, once we understand these cases better).
This commit is contained in:
Victoria Brekenfeld 2025-09-10 18:25:33 +02:00 committed by Victoria Brekenfeld
parent cd1117080c
commit b83e9f1d32
8 changed files with 232 additions and 91 deletions

View file

@ -227,7 +227,7 @@ pub fn init_backend(
.add_heads(std::iter::once(&output));
{
state.common.add_output(&output);
state.common.config.read_outputs(
if let Err(err) = state.common.config.read_outputs(
&mut state.common.output_configuration_state,
&mut state.backend,
&state.common.shell,
@ -236,7 +236,9 @@ pub fn init_backend(
&state.common.xdg_activation_state,
state.common.startup_done.clone(),
&state.common.clock,
);
) {
error!("Unrecoverable output config error: {}", err);
}
state.common.refresh();
}
state.launch_xwayland(None);