aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-05-14 15:56:01 +0200
committervaxerski <[email protected]>2022-05-14 15:56:01 +0200
commitcafd7a7a6224b5c0d2aecf53cfeecbc4ef620bcc (patch)
tree0dd3759cfa7de50aeb1f42c11e03e16098f48dc9
parenta1567feb3ded69ae7dd6f46bf7d1da82ee3a5ecc (diff)
downloadHyprland-cafd7a7a6224b5c0d2aecf53cfeecbc4ef620bcc.tar.gz
Hyprland-cafd7a7a6224b5c0d2aecf53cfeecbc4ef620bcc.zip
Added an animation= keyword
-rw-r--r--src/config/ConfigManager.cpp70
-rw-r--r--src/config/ConfigManager.hpp1
2 files changed, 57 insertions, 14 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 6716de5d..b52b4b96 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -277,6 +277,53 @@ void CConfigManager::handleBezier(const std::string& command, const std::string&
g_pAnimationManager->addBezierWithName(bezierName, Vector2D(p1x, p1y), Vector2D(p2x, p2y));
}
+void CConfigManager::handleAnimation(const std::string& command, const std::string& args) {
+ std::string curitem = "";
+
+ std::string argZ = args;
+
+ auto nextItem = [&]() {
+ auto idx = argZ.find_first_of(',');
+
+ if (idx != std::string::npos) {
+ curitem = argZ.substr(0, idx);
+ argZ = argZ.substr(idx + 1);
+ } else {
+ curitem = argZ;
+ argZ = "";
+ }
+ };
+
+ nextItem();
+
+ // Master on/off
+
+ // anim name
+ const auto ANIMNAME = curitem;
+ const auto ANIMMASTERSETTING = configValues.find("animations:" + ANIMNAME);
+
+ if (ANIMMASTERSETTING == configValues.end()) {
+ Debug::log(ERR, "Anim %s doesnt exist", ANIMNAME.c_str());
+ parseError = "Animation " + ANIMNAME + " does not exist";
+ return;
+ }
+
+ nextItem();
+
+ // on/off
+ configSetValueSafe("animations:" + ANIMNAME, curitem);
+
+ nextItem();
+
+ // Speed
+ configSetValueSafe("animations:" + ANIMNAME + "_speed", curitem);
+
+ nextItem();
+
+ // curve
+ configSetValueSafe("animations:" + ANIMNAME + "_curve", curitem);
+}
+
void CConfigManager::handleBind(const std::string& command, const std::string& value) {
// example:
// bind=SUPER,G,exec,dmenu_run <args>
@@ -379,21 +426,16 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
if (isFirstLaunch) {
firstExecRequests.push_back(VALUE);
}
- } else if (COMMAND == "monitor") {
- handleMonitor(COMMAND, VALUE);
- } else if (COMMAND == "bind") {
- handleBind(COMMAND, VALUE);
- } else if (COMMAND == "unbind") {
- handleUnbind(COMMAND, VALUE);
- } else if (COMMAND == "workspace") {
- handleDefaultWorkspace(COMMAND, VALUE);
- } else if (COMMAND == "windowrule") {
- handleWindowRule(COMMAND, VALUE);
- } else if (COMMAND == "bezier") {
- handleBezier(COMMAND, VALUE);
- } else {
- configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
}
+ else if (COMMAND == "monitor") handleMonitor(COMMAND, VALUE);
+ else if (COMMAND == "bind") handleBind(COMMAND, VALUE);
+ else if (COMMAND == "unbind") handleUnbind(COMMAND, VALUE);
+ else if (COMMAND == "workspace") handleDefaultWorkspace(COMMAND, VALUE);
+ else if (COMMAND == "windowrule") handleWindowRule(COMMAND, VALUE);
+ else if (COMMAND == "bezier") handleBezier(COMMAND, VALUE);
+ else if (COMMAND == "animation") handleAnimation(COMMAND, VALUE);
+ else
+ configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE);
if (dynamic) {
std::string retval = parseError;
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index fa183cae..9398b4f6 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -105,6 +105,7 @@ private:
void handleWindowRule(const std::string&, const std::string&);
void handleDefaultWorkspace(const std::string&, const std::string&);
void handleBezier(const std::string&, const std::string&);
+ void handleAnimation(const std::string&, const std::string&);
};
inline std::unique_ptr<CConfigManager> g_pConfigManager; \ No newline at end of file