mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-17 03:46:01 +01:00
dispatchers: fixup dpms toggle (#7875)
now toggles every monitor individually
This commit is contained in:
parent
22746b3046
commit
b1ad2d8066
1 changed files with 4 additions and 3 deletions
|
@ -2403,9 +2403,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
|
||||||
bool enable = arg.starts_with("on");
|
bool enable = arg.starts_with("on");
|
||||||
std::string port = "";
|
std::string port = "";
|
||||||
|
|
||||||
if (arg.starts_with("toggle"))
|
bool isToggle = 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
|
|
||||||
|
|
||||||
if (arg.find_first_of(' ') != std::string::npos)
|
if (arg.find_first_of(' ') != std::string::npos)
|
||||||
port = arg.substr(arg.find_first_of(' ') + 1);
|
port = arg.substr(arg.find_first_of(' ') + 1);
|
||||||
|
|
||||||
|
@ -2414,6 +2412,9 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
|
||||||
if (!port.empty() && m->szName != port)
|
if (!port.empty() && m->szName != port)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (isToggle)
|
||||||
|
enable = !m->dpmsStatus;
|
||||||
|
|
||||||
m->output->state->resetExplicitFences();
|
m->output->state->resetExplicitFences();
|
||||||
m->output->state->setEnabled(enable);
|
m->output->state->setEnabled(enable);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue