diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-04-24 11:22:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-24 11:22:44 +0200 |
| commit | 6679a4786b593cbe5050931261566fab9aa77f1f (patch) | |
| tree | a090b5c34cb75d4328c79f587018457a5e589c0a /src/config/ConfigManager.cpp | |
| parent | fc14157d765ce44e634525b2c437808e20ec93d6 (diff) | |
| parent | 1afc8329bc4438c3e2f8c3dda9a6743ce5ef7a3a (diff) | |
Merge pull request #55 from vaxerski/animation-system-rework
Animation system rework
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index f321651c..e6d0ccd1 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -43,10 +43,14 @@ void CConfigManager::setDefaultVars() { configValues["animations:enabled"].intValue = 1; configValues["animations:speed"].floatValue = 7.f; + configValues["animations:curve"].strValue = "default"; + configValues["animations:windows_curve"].strValue = "[[f]]"; configValues["animations:windows_speed"].floatValue = 0.f; configValues["animations:windows"].intValue = 1; + configValues["animations:borders_curve"].strValue = "[[f]]"; configValues["animations:borders_speed"].floatValue = 0.f; configValues["animations:borders"].intValue = 1; + configValues["animations:fadein_curve"].strValue = "[[f]]"; configValues["animations:fadein_speed"].floatValue = 0.f; configValues["animations:fadein"].intValue = 1; @@ -207,6 +211,39 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string m_dMonitorRules.push_back(newrule); } +void CConfigManager::handleBezier(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(); + + std::string bezierName = curitem; + + nextItem(); + float p1x = std::stof(curitem); + nextItem(); + float p1y = std::stof(curitem); + nextItem(); + float p2x = std::stof(curitem); + nextItem(); + float p2y = std::stof(curitem); + + g_pAnimationManager->addBezierWithName(bezierName, Vector2D(p1x, p1y), Vector2D(p2x, p2y)); +} + void CConfigManager::handleBind(const std::string& command, const std::string& value) { // example: // bind=SUPER,G,exec,dmenu_run <args> @@ -311,6 +348,8 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std:: handleDefaultWorkspace(COMMAND, VALUE); } else if (COMMAND == "windowrule") { handleWindowRule(COMMAND, VALUE); + } else if (COMMAND == "bezier") { + handleBezier(COMMAND, VALUE); } else { configSetValueSafe(currentCategory + (currentCategory == "" ? "" : ":") + COMMAND, VALUE); } @@ -379,10 +418,10 @@ void CConfigManager::loadConfigLoadVars() { // reset all vars before loading setDefaultVars(); - m_dMonitorRules.clear(); m_dWindowRules.clear(); g_pKeybindManager->clearKeybinds(); + g_pAnimationManager->removeAllBeziers(); const char* const ENVHOME = getenv("HOME"); const std::string CONFIGPATH = ENVHOME + (ISDEBUG ? (std::string) "/.config/hypr/hyprlandd.conf" : (std::string) "/.config/hypr/hyprland.conf"); @@ -606,3 +645,7 @@ void CConfigManager::performMonitorReload() { m_bWantsMonitorReload = false; } + +SConfigValue* CConfigManager::getConfigValuePtr(std::string val) { + return &configValues[val]; +}
\ No newline at end of file |
