Skip to content

Commit

Permalink
dispatchers: fixup dpms toggle (#7875)
Browse files Browse the repository at this point in the history
now toggles every monitor individually
  • Loading branch information
Kam1k4dze authored Sep 25, 2024
1 parent 22746b3 commit b1ad2d8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/managers/KeybindManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2403,9 +2403,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
bool enable = arg.starts_with("on");
std::string port = "";

if (arg.starts_with("toggle"))
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

bool isToggle = arg.starts_with("toggle");
if (arg.find_first_of(' ') != std::string::npos)
port = arg.substr(arg.find_first_of(' ') + 1);

Expand All @@ -2414,6 +2412,9 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
if (!port.empty() && m->szName != port)
continue;

if (isToggle)
enable = !m->dpmsStatus;

m->output->state->resetExplicitFences();
m->output->state->setEnabled(enable);

Expand Down

0 comments on commit b1ad2d8

Please sign in to comment.