From 4bc669f9331bb66ab30bd705d09f1239bc3e83ed Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 28 Feb 2024 15:00:34 +0000 Subject: layers: add fully featured animations Adds configs and layerrules to handle them alas fixes #981 I have cooked --- src/managers/AnimationManager.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/managers/AnimationManager.cpp') diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index 23584827..859e3b03 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -101,7 +101,7 @@ void CAnimationManager::tick() { g_pHyprRenderer->damageWindow(w.get()); } } else if (PLAYER) { - WLRBOXPREV = PLAYER->geometry; + WLRBOXPREV = CBox{PLAYER->realPosition.vec(), PLAYER->realSize.vec()}; PMONITOR = g_pCompositor->getMonitorFromVector(Vector2D(PLAYER->geometry.x, PLAYER->geometry.y) + Vector2D(PLAYER->geometry.width, PLAYER->geometry.height) / 2.f); if (!PMONITOR) continue; @@ -513,6 +513,27 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config, if (style == "loop" || style == "once") return ""; return "unknown style"; + } else if (config.starts_with("layers")) { + if (style == "fade" || style == "" || style == "slide") + return ""; + else if (style.starts_with("popin")) { + // try parsing + float minPerc = 0.f; + if (style.find("%") != std::string::npos) { + try { + auto percstr = style.substr(style.find_last_of(' ')); + minPerc = std::stoi(percstr.substr(0, percstr.length() - 1)); + } catch (std::exception& e) { return "invalid minperc"; } + + return ""; + } + + minPerc; // fix warning + + return ""; + } + return ""; + return "unknown style"; } else { return "animation has no styles"; } -- cgit v1.2.3