mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 13:29:49 +01:00
master: Add mfact dispatcher (#3298)
* add mfact dispatcher * limit mfact to between 0.05 and 0.95 * add try catch block for stof * change log to err
This commit is contained in:
parent
f8008e4b3b
commit
d3cbec2d1a
1 changed files with 14 additions and 0 deletions
|
@ -1227,6 +1227,20 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
||||||
runOrientationCycle(header, nullptr, -1);
|
runOrientationCycle(header, nullptr, -1);
|
||||||
} else if (command == "orientationcycle") {
|
} else if (command == "orientationcycle") {
|
||||||
runOrientationCycle(header, &vars, 1);
|
runOrientationCycle(header, &vars, 1);
|
||||||
|
} else if (command == "mfact") {
|
||||||
|
if (vars.size() >= 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue