summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorJulian Schuler <31921487+julianschuler@users.noreply.github.com>2022-12-17 23:37:44 +0100
committerGitHub <noreply@github.com>2022-12-17 22:37:44 +0000
commit2daabfa0e981d8d2e33c068c9cc84ecb3cf2daa0 (patch)
tree02b4cdf3dfae7874fdb6f5893d46531a9b8ad6f6 /src/managers/KeybindManager.cpp
parent0f3214714f237afcccb5d6a1bd3cdb5b26ddbcfb (diff)
Add 'exact' option for 'splitratio' (#1245)
* Simplify getPlusMinusKeywordResult() * Add an 'exact' option for 'splitratio'
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 77db9eca..fffdaa4b 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1152,6 +1152,7 @@ void CKeybindManager::toggleSplit(std::string args) {
void CKeybindManager::alterSplitRatio(std::string args) {
float splitratio = 0;
+ bool exact = false;
if (args == "+" || args == "-") {
Debug::log(LOG, "alterSplitRatio: using LEGACY +/-, consider switching to the Hyprland syntax.");
@@ -1159,7 +1160,12 @@ void CKeybindManager::alterSplitRatio(std::string args) {
}
if (splitratio == 0) {
- splitratio = getPlusMinusKeywordResult(args, 0);
+ if (args.find("exact") == 0) {
+ exact = true;
+ splitratio = getPlusMinusKeywordResult(args.substr(5), 0);
+ } else {
+ splitratio = getPlusMinusKeywordResult(args, 0);
+ }
}
if (splitratio == INT_MAX) {
@@ -1172,7 +1178,7 @@ void CKeybindManager::alterSplitRatio(std::string args) {
if (!PLASTWINDOW)
return;
- g_pLayoutManager->getCurrentLayout()->alterSplitRatioBy(PLASTWINDOW, splitratio);
+ g_pLayoutManager->getCurrentLayout()->alterSplitRatio(PLASTWINDOW, splitratio, exact);
}
void CKeybindManager::focusMonitor(std::string arg) {