animations: add the gnomed animation style for windows

This commit is contained in:
Vaxry
2025-02-16 20:53:49 +00:00
parent 897ee276dc
commit e2a9271150
2 changed files with 22 additions and 2 deletions

View File

@@ -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

View File

@@ -59,6 +59,7 @@ class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager {
// Anim stuff
void animationPopin(PHLWINDOW, bool close = false, float minPerc = 0.f);
void animationSlide(PHLWINDOW, std::string force = "", bool close = false);
void animationGnomed(PHLWINDOW, bool close = false);
};
inline UP<CHyprAnimationManager> g_pAnimationManager;