master: change the mfact dispatcher to use splitratio (#4766)

* master layout: change the mfact dispatcher to use splitratio

* add space for concat
This commit is contained in:
thejch 2024-04-12 17:54:18 -07:00 committed by GitHub
parent 0c513ba91b
commit 34396f55a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1285,19 +1285,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
} else if (command == "orientationcycle") { } else if (command == "orientationcycle") {
runOrientationCycle(header, &vars, 1); runOrientationCycle(header, &vars, 1);
} else if (command == "mfact") { } else if (command == "mfact") {
if (vars.size() >= 2) { g_pKeybindManager->m_mDispatchers["splitratio"](vars[1] + " " + vars[2]);
float newMfact = 0;
try {
newMfact = std::stof(vars[1]);
} catch (std::exception& e) {
Debug::log(ERR, "Argument is invalid: {}", e.what());
return 0;
}
for (auto& nd : m_lMasterNodesData) {
if (nd.isMaster)
nd.percMaster = std::clamp(newMfact, 0.05f, 0.95f);
}
}
} else if (command == "rollnext") { } else if (command == "rollnext") {
const auto PWINDOW = header.pWindow; const auto PWINDOW = header.pWindow;
const auto PNODE = getNodeFromWindow(PWINDOW); const auto PNODE = getNodeFromWindow(PWINDOW);