From 08651736ada39f62b246c44c1d8a81e2787f23d5 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sun, 30 Jul 2023 16:46:33 +0200 Subject: [PATCH] keybinds: add toggle to dpms --- src/managers/KeybindManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 3b87f3b3..c382cabe 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1837,6 +1837,9 @@ void CKeybindManager::dpms(std::string arg) { bool enable = arg.find("on") == 0; std::string port = ""; + if (arg.find("toggle") == 0) + enable = !std::any_of(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](const auto& other) { return !other->dpmsStatus; }); // enable if any is off + if (arg.find_first_of(' ') != std::string::npos) port = arg.substr(arg.find_first_of(' ') + 1);