aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Huang <[email protected]>2023-09-15 04:03:05 -0700
committerGitHub <[email protected]>2023-09-15 12:03:05 +0100
commitd3cbec2d1a2aa7854fe0f05c06f6bd6d8388838e (patch)
tree94e767cbc574b4ea2ad545e37a681a84407f0ad0
parentf8008e4b3beb4aae2365973879a46fe0f15c79b4 (diff)
downloadHyprland-d3cbec2d1a2aa7854fe0f05c06f6bd6d8388838e.tar.gz
Hyprland-d3cbec2d1a2aa7854fe0f05c06f6bd6d8388838e.zip
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
-rw-r--r--src/layout/MasterLayout.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/layout/MasterLayout.cpp b/src/layout/MasterLayout.cpp
index 0fec8efd..a4ab9d8a 100644
--- a/src/layout/MasterLayout.cpp
+++ b/src/layout/MasterLayout.cpp
@@ -1227,6 +1227,20 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
runOrientationCycle(header, nullptr, -1);
} else if (command == "orientationcycle") {
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;