From 3c25474b41349830cb9a7b482fc908502cc7435c Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Tue, 21 Nov 2023 18:06:05 +0100 Subject: [PATCH] outputconfigurationstore: ensure that the config doesn't turn off all outputs --- src/outputconfigurationstore.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/outputconfigurationstore.cpp b/src/outputconfigurationstore.cpp index e24590b624..b1950d3b47 100644 --- a/src/outputconfigurationstore.cpp +++ b/src/outputconfigurationstore.cpp @@ -735,6 +735,13 @@ void OutputConfigurationStore::load() if (fail || setup.outputs.empty()) { continue; } + // one of the outputs must be enabled + const bool noneEnabled = std::none_of(setup.outputs.begin(), setup.outputs.end(), [](const auto &output) { + return output.enabled; + }); + if (noneEnabled) { + continue; + } setup.lidClosed = data["lidClosed"].toBool(false); // there must be only one setup that refers to a given set of outputs const bool alreadyExists = std::any_of(m_setups.begin(), m_setups.end(), [&setup](const auto &other) {