summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 2644cf53..4ef7d229 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -18,6 +18,7 @@
#include "../managers/EventManager.hpp"
#include "../render/Renderer.hpp"
#include "../hyprerror/HyprError.hpp"
+#include "../config/ConfigManager.hpp"
#include <optional>
#include <iterator>
@@ -3221,7 +3222,7 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
} else if (auto search = NWindowProperties::boolWindowProperties.find(PROP); search != NWindowProperties::boolWindowProperties.end()) {
auto pWindowDataElement = search->second(PWINDOW);
if (VAL == "toggle")
- *pWindowDataElement = CWindowOverridableVar(!pWindowDataElement->valueOrDefault(), PRIORITY_SET_PROP);
+ pWindowDataElement->increment(true, PRIORITY_SET_PROP);
else if (VAL == "unset")
pWindowDataElement->unset(PRIORITY_SET_PROP);
else
@@ -3229,12 +3230,18 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
} else if (auto search = NWindowProperties::intWindowProperties.find(PROP); search != NWindowProperties::intWindowProperties.end()) {
if (VAL == "unset")
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
- else if (const auto V = configStringToInt(VAL); V)
- *(search->second(PWINDOW)) = CWindowOverridableVar((int)*V, PRIORITY_SET_PROP);
+ else if (VAL.starts_with("relative")) {
+ const Hyprlang::INT V = std::stoi(VAL.substr(VAL.find(' ')));
+ search->second(PWINDOW)->increment(V, PRIORITY_SET_PROP);
+ } else if (const auto V = configStringToInt(VAL); V)
+ *(search->second(PWINDOW)) = CWindowOverridableVar((Hyprlang::INT)*V, PRIORITY_SET_PROP);
} else if (auto search = NWindowProperties::floatWindowProperties.find(PROP); search != NWindowProperties::floatWindowProperties.end()) {
if (VAL == "unset")
search->second(PWINDOW)->unset(PRIORITY_SET_PROP);
- else {
+ else if (VAL.starts_with("relative")) {
+ const auto V = std::stof(VAL.substr(VAL.find(' ')));
+ search->second(PWINDOW)->increment(V, PRIORITY_SET_PROP);
+ } else {
const auto V = std::stof(VAL);
*(search->second(PWINDOW)) = CWindowOverridableVar(V, PRIORITY_SET_PROP);
}