add dpms per output

This commit is contained in:
Vaxry 2022-10-05 10:31:47 +01:00
parent 71e2562a41
commit 0e4a894edb
1 changed files with 10 additions and 1 deletions

View File

@ -1568,9 +1568,18 @@ void CKeybindManager::toggleOpaque(std::string unused) {
} }
void CKeybindManager::dpms(std::string arg) { void CKeybindManager::dpms(std::string arg) {
bool enable = arg == "on"; bool enable = arg.find("on") == 0;
std::string port = "";
if (arg.find_first_of(' ') != std::string::npos) {
port = arg.substr(arg.find_first_of(' ') + 1);
}
for (auto& m : g_pCompositor->m_vMonitors) { for (auto& m : g_pCompositor->m_vMonitors) {
if (!port.empty() && m->szName != port)
continue;
wlr_output_enable(m->output, enable); wlr_output_enable(m->output, enable);
if (!wlr_output_commit(m->output)) { if (!wlr_output_commit(m->output)) {