summaryrefslogtreecommitdiff
path: root/src/managers/AnimationManager.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2025-02-16 20:53:49 +0000
committerVaxry <vaxry@vaxry.net>2025-02-16 20:53:49 +0000
commite2a9271150f9f1a2cba825f6f21bb130effc6b11 (patch)
tree238b325fd42a4c7696858559b05a3c17b88ec3f9 /src/managers/AnimationManager.cpp
parent897ee276dc0a8a6b11a8102b225a9e969faac0bf (diff)
animations: add the gnomed animation style for windows
Diffstat (limited to 'src/managers/AnimationManager.cpp')
-rw-r--r--src/managers/AnimationManager.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index 29f669dc..18dae2a4 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -357,6 +357,21 @@ void CHyprAnimationManager::animationSlide(PHLWINDOW pWindow, std::string force,
*pWindow->m_vRealPosition = posOffset;
}
+void CHyprAnimationManager::animationGnomed(PHLWINDOW pWindow, bool close) {
+ const auto GOALPOS = pWindow->m_vRealPosition->goal();
+ const auto GOALSIZE = pWindow->m_vRealSize->goal();
+
+ if (close) {
+ *pWindow->m_vRealPosition = GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F};
+ *pWindow->m_vRealSize = Vector2D{GOALSIZE.x, 0.F};
+ } else {
+ pWindow->m_vRealPosition->setValueAndWarp(GOALPOS + Vector2D{0.F, GOALSIZE.y / 2.F});
+ pWindow->m_vRealSize->setValueAndWarp(Vector2D{GOALSIZE.x, 0.F});
+ *pWindow->m_vRealPosition = GOALPOS;
+ *pWindow->m_vRealSize = GOALSIZE;
+ }
+}
+
void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool close) {
if (!close) {
pWindow->m_vRealPosition->setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsIn"));
@@ -387,7 +402,9 @@ void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool clos
if (STYLE.starts_with("slide")) {
CVarList animList2(STYLE, 0, 's');
animationSlide(pWindow, animList2[1], close);
- } else {
+ } else if (STYLE == "gnomed" || STYLE == "gnome")
+ animationGnomed(pWindow, close);
+ else {
// anim popin, fallback
float minPerc = 0.f;
@@ -405,6 +422,8 @@ void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool clos
} else {
if (animList[0] == "slide")
animationSlide(pWindow, animList[1], close);
+ else if (animList[0] == "gnomed" || animList[0] == "gnome")
+ animationGnomed(pWindow, close);
else {
// anim popin, fallback
@@ -425,7 +444,7 @@ void CHyprAnimationManager::onWindowPostCreateClose(PHLWINDOW pWindow, bool clos
std::string CHyprAnimationManager::styleValidInConfigVar(const std::string& config, const std::string& style) {
if (config.starts_with("window")) {
- if (style.starts_with("slide"))
+ if (style.starts_with("slide") || style == "gnome" || style == "gnomed")
return "";
else if (style.starts_with("popin")) {
// try parsing