aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-07-30 16:46:33 +0200
committervaxerski <[email protected]>2023-07-30 16:46:37 +0200
commit08651736ada39f62b246c44c1d8a81e2787f23d5 (patch)
treed7d618a259edbc19f66fcc2f6c73256332bd2616
parentbf0d8ab4a3c44728cd1330ee32a8143ad1f5dcdd (diff)
downloadHyprland-08651736ada39f62b246c44c1d8a81e2787f23d5.tar.gz
Hyprland-08651736ada39f62b246c44c1d8a81e2787f23d5.zip
keybinds: add toggle to dpms
-rw-r--r--src/managers/KeybindManager.cpp3
1 files changed, 3 insertions, 0 deletions
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);