From 7e3759164c958c24d10e5bcb7ac2ec4c2fc3d5fe Mon Sep 17 00:00:00 2001 From: daxis Date: Thu, 30 Jan 2025 01:31:26 +0100 Subject: [PATCH 01/19] Update Log.hpp --- src/Log.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Log.hpp b/src/Log.hpp index 82c089a..719c0f2 100644 --- a/src/Log.hpp +++ b/src/Log.hpp @@ -3,7 +3,7 @@ #include template -void hyprfocus_log(eLogLevel level, std::format_string fmt, +void hyprfocus_log(LogLevel level, std::format_string fmt, Args &&...args) { auto msg = std::vformat(fmt.get(), std::make_format_args(args...)); Debug::log(level, "[hyprfocus] {}", msg); From 3167c6dd005508e03f477fe81955ccca90b36fca Mon Sep 17 00:00:00 2001 From: daxis Date: Thu, 30 Jan 2025 01:33:11 +0100 Subject: [PATCH 02/19] Update Log.hpp --- src/Log.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Log.hpp b/src/Log.hpp index 719c0f2..82c089a 100644 --- a/src/Log.hpp +++ b/src/Log.hpp @@ -3,7 +3,7 @@ #include template -void hyprfocus_log(LogLevel level, std::format_string fmt, +void hyprfocus_log(eLogLevel level, std::format_string fmt, Args &&...args) { auto msg = std::vformat(fmt.get(), std::make_format_args(args...)); Debug::log(level, "[hyprfocus] {}", msg); From 56f69905826107df7bebaec0b7a3e69d7a9866a6 Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:19:08 +0100 Subject: [PATCH 03/19] Update Flash.cpp --- src/Flash.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Flash.cpp b/src/Flash.cpp index e4b14a8..917a65b 100644 --- a/src/Flash.cpp +++ b/src/Flash.cpp @@ -33,17 +33,17 @@ void CFlash::onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle) { static const auto *flash_opacity = (Hyprlang::FLOAT *const *)(getConfigValue(pHandle, "flash_opacity") ->getDataStaticPtr()); - pWindow->m_fAlpha = **flash_opacity; + *pWindow->m_fAlpha = **flash_opacity; // pWindow->m_fAlpha = g_fFlashOpacity; - pWindow->m_fAlpha.setConfig(&m_sFocusInAnimConfig); - pWindow->m_fAlpha.setCallbackOnEnd([this, pWindow, pHandle](void *) { + pWindow->m_fAlpha->setConfig(m_sFocusInAnimConfig); + pWindow->m_fAlpha->setCallbackOnEnd([this, pWindow, pHandle](CWeakPointer pAnim) { static const auto *active_opacity = (Hyprlang::FLOAT *const *)(HyprlandAPI::getConfigValue( pHandle, "decoration:active_opacity") ->getDataStaticPtr()); // Make sure we restore to the active window opacity - pWindow->m_fAlpha = **active_opacity; + *pWindow->m_fAlpha = **active_opacity; // pWindow->m_fAlpha = g_fActiveOpacity; - pWindow->m_fAlpha.setConfig(&m_sFocusOutAnimConfig); + pWindow->m_fAlpha->setConfig(m_sFocusOutAnimConfig); }); } From 62e84a71a306e193c0e287a88a8b128dcf71255e Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:19:37 +0100 Subject: [PATCH 04/19] Update Flash.hpp From 56af31a234c653a2f4436097262f2e8bcb2496f0 Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:20:09 +0100 Subject: [PATCH 05/19] Update Globals.hpp From dda45be44912cc150a93138761d5ace7bb11b07d Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:21:31 +0100 Subject: [PATCH 06/19] Update IFocusAnimation.cpp --- src/IFocusAnimation.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/IFocusAnimation.cpp b/src/IFocusAnimation.cpp index 706bcb8..c8741b9 100644 --- a/src/IFocusAnimation.cpp +++ b/src/IFocusAnimation.cpp @@ -19,18 +19,18 @@ void IFocusAnimation::init(HANDLE pHandle, std::string animationName) { Hyprlang::FLOAT{5.f}); m_sFocusInAnimConfig = - *(g_pConfigManager->getAnimationPropertyConfig("global")); - m_sFocusInAnimConfig.internalEnabled = 1; - m_sFocusInAnimConfig.internalStyle = + (g_pConfigManager->getAnimationPropertyConfig("global")); + m_sFocusInAnimConfig->internalEnabled = 1; + m_sFocusInAnimConfig->internalStyle = std::string("hyprfocus_") + animationName + std::string("_in"); - m_sFocusInAnimConfig.pValues = &m_sFocusInAnimConfig; + m_sFocusInAnimConfig->pValues = m_sFocusInAnimConfig; m_sFocusOutAnimConfig = - *(g_pConfigManager->getAnimationPropertyConfig("global")); - m_sFocusOutAnimConfig.internalEnabled = 1; - m_sFocusOutAnimConfig.internalStyle = + (g_pConfigManager->getAnimationPropertyConfig("global")); + m_sFocusOutAnimConfig->internalEnabled = 1; + m_sFocusOutAnimConfig->internalStyle = std::string("hyprfocus_") + animationName + std::string("_out"); - m_sFocusOutAnimConfig.pValues = &m_sFocusOutAnimConfig; + m_sFocusOutAnimConfig->pValues = CWeakPointer(m_sFocusOutAnimConfig); } void IFocusAnimation::setup(HANDLE pHandle, std::string animationName) { @@ -55,17 +55,17 @@ void IFocusAnimation::onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle) { (Hyprlang::FLOAT *const *)(HyprlandAPI::getConfigValue( pHandle, configPrefix() + "out_speed") ->getDataStaticPtr()); - m_sFocusInAnimConfig.internalBezier = *inBezier; - m_sFocusInAnimConfig.internalSpeed = **inSpeed; + m_sFocusInAnimConfig->internalBezier = *inBezier; + m_sFocusInAnimConfig->internalSpeed = **inSpeed; - m_sFocusOutAnimConfig.internalBezier = *outBezier; - m_sFocusOutAnimConfig.internalSpeed = **outSpeed; + m_sFocusOutAnimConfig->internalBezier = *outBezier; + m_sFocusOutAnimConfig->internalSpeed = **outSpeed; hyprfocus_log(LOG, "In bezier: {} In speed: {} Out bezier: {} Out speed: {}", - m_sFocusInAnimConfig.internalBezier, - m_sFocusInAnimConfig.internalSpeed, - m_sFocusOutAnimConfig.internalBezier, - m_sFocusOutAnimConfig.internalSpeed); + m_sFocusInAnimConfig->internalBezier, + m_sFocusInAnimConfig->internalSpeed, + m_sFocusOutAnimConfig->internalBezier, + m_sFocusOutAnimConfig->internalSpeed); } void IFocusAnimation::addConfigValue(HANDLE pHandle, std::string name, From a52dc41a3b076a9539308d430aa4a63eb632892a Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:22:07 +0100 Subject: [PATCH 07/19] Update IFocusAnimation.hpp --- src/IFocusAnimation.hpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/IFocusAnimation.hpp b/src/IFocusAnimation.hpp index c8a7295..26fb494 100644 --- a/src/IFocusAnimation.hpp +++ b/src/IFocusAnimation.hpp @@ -5,6 +5,9 @@ #include +using namespace Hyprutils::Memory; +using namespace Hyprutils::Animation; + class IFocusAnimation { public: virtual void onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle); @@ -16,8 +19,8 @@ class IFocusAnimation { Hyprlang::CConfigValue *getConfigValue(HANDLE pHandle, std::string name); public: - SAnimationPropertyConfig m_sFocusInAnimConfig; - SAnimationPropertyConfig m_sFocusOutAnimConfig; + CSharedPointer m_sFocusInAnimConfig = makeShared(); + CSharedPointer m_sFocusOutAnimConfig = makeShared(); std::string m_szAnimationName; From cc1bfc9b565e5a78093c6840d9554b98d7270fdc Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:23:31 +0100 Subject: [PATCH 08/19] Update Shrink.cpp --- src/Shrink.cpp | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/Shrink.cpp b/src/Shrink.cpp index fb027fe..9be10ea 100644 --- a/src/Shrink.cpp +++ b/src/Shrink.cpp @@ -22,39 +22,44 @@ void CShrink::setup(HANDLE pHandle, std::string animationName) { void CShrink::onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle) { std::string currentAnimStyle = - pWindow->m_vRealSize.getConfig()->internalStyle; + pWindow->m_vRealSize->getConfig()->internalStyle; hyprfocus_log(LOG, "Current animation style: {}", currentAnimStyle); if ((currentAnimStyle == "popout" || currentAnimStyle == "popin") && - pWindow->m_vRealSize.isBeingAnimated()) { + pWindow->m_vRealSize->isBeingAnimated()) { hyprfocus_log(LOG, "Shrink: Window is already being animated, skipping"); return; } IFocusAnimation::onWindowFocus(pWindow, pHandle); - pWindow->m_vRealSize.setConfig(&m_sFocusOutAnimConfig); - pWindow->m_vRealPosition.setConfig(&m_sFocusOutAnimConfig); + pWindow->m_vRealSize->setConfig(m_sFocusOutAnimConfig); + pWindow->m_vRealPosition->setConfig(m_sFocusOutAnimConfig); + + g_pAnimationManager->createAnimation(1.0f, m_sShrinkAnimation, + m_sFocusOutAnimConfig, pWindow, AVARDAMAGE_ENTIRE); - m_sShrinkAnimation.registerVar(); - m_sShrinkAnimation.create(1.0f, &m_sFocusInAnimConfig, AVARDAMAGE_ENTIRE); static const auto *shrinkPercentage = (Hyprlang::FLOAT *const *)(getConfigValue(pHandle, "shrink_percentage") ->getDataStaticPtr()); hyprfocus_log(LOG, "Shrink percentage: {}", **shrinkPercentage); - m_sShrinkAnimation = **shrinkPercentage; + m_sShrinkAnimation->setValue(**shrinkPercentage); - m_sShrinkAnimation.setUpdateCallback([this, pWindow](void *pShrinkAnimation) { - const auto GOALPOS = pWindow->m_vRealPosition.goal(); - const auto GOALSIZE = pWindow->m_vRealSize.goal(); + m_sShrinkAnimation->setUpdateCallback( + [this, pWindow](CWeakPointer pShrinkAnimation) { + const auto GOALPOS = pWindow->m_vRealPosition->goal(); + const auto GOALSIZE = pWindow->m_vRealSize->goal(); - const auto *PANIMATION = (CAnimatedVariable *)pShrinkAnimation; + const auto *PANIMATION = + (CAnimatedVariable *)pShrinkAnimation.get(); - pWindow->m_vRealSize.setValue(GOALSIZE * PANIMATION->value()); - pWindow->m_vRealPosition.setValue(GOALPOS + GOALSIZE / 2.f - - pWindow->m_vRealSize.value() / 2.f); - }); + pWindow->m_vRealSize->setValue(GOALSIZE * PANIMATION->value()); + pWindow->m_vRealPosition->setValue(GOALPOS + GOALSIZE / 2.f - + pWindow->m_vRealSize->value() / 2.f); + }); - m_sShrinkAnimation.setCallbackOnEnd([this, pWindow](void *pShrinkAnimation) { - ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks(); - }); + m_sShrinkAnimation->setCallbackOnEnd( + [this, pWindow](CWeakPointer pShrinkAnimation) { + ((CAnimatedVariable *)(pShrinkAnimation.get())) + ->resetAllCallbacks(); + }); } From 29ea3763a606230da345cf2a013a81aa11091cda Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:24:08 +0100 Subject: [PATCH 09/19] Update Shrink.hpp --- src/Shrink.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shrink.hpp b/src/Shrink.hpp index c2f3f02..c6677c1 100644 --- a/src/Shrink.hpp +++ b/src/Shrink.hpp @@ -6,5 +6,5 @@ class CShrink : public IFocusAnimation { void init(HANDLE pHandle, std::string animationName) override; void setup(HANDLE pHandle, std::string animationName) override; - CAnimatedVariable m_sShrinkAnimation; + PHLANIMVAR m_sShrinkAnimation; }; From 990ef6e57d4ea9ec0c495a08a9da7e64faafae46 Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:24:59 +0100 Subject: [PATCH 10/19] Update main.cpp --- src/main.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8ec92a2..e41c8cd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,23 +64,34 @@ void flashWindow(PHLWINDOW pWindow) { } } -void flashCurrentWindow(std::string) { +SDispatchResult flashCurrentWindow(std::string) { hyprfocus_log(LOG, "Flashing current window"); + SDispatchResult result = { + .passEvent = false, + .success = true, + }; static auto *const PHYPRFOCUSENABLED = (Hyprlang::INT *const *)HyprlandAPI::getConfigValue( PHANDLE, "plugin:hyprfocus:enabled") ->getDataStaticPtr(); if (!*PHYPRFOCUSENABLED) { + const std::string message = "HyprFocus is disabled"; hyprfocus_log(LOG, "HyprFocus is disabled"); - return; + result.success = false; + result.error = message; + return result; } if (g_pPreviouslyFocusedWindow == nullptr) { + const std::string message = "No previously focused window"; hyprfocus_log(LOG, "No previously focused window"); - return; + result.success = false; + result.error = message; + return result; } - + result.passEvent = true; flashWindow(g_pPreviouslyFocusedWindow); + return result; } static void onActiveWindowChange(void *self, std::any data) { @@ -169,7 +180,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { Hyprlang::INT{1}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:focus_animation", Hyprlang::STRING("flash")); - HyprlandAPI::addDispatcher(PHANDLE, "animatefocused", &flashCurrentWindow); + HyprlandAPI::addDispatcherV2(PHANDLE, "animatefocused", &flashCurrentWindow); g_mAnimations["flash"] = std::make_unique(); g_mAnimations["shrink"] = std::make_unique(); @@ -181,7 +192,8 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { } HyprlandAPI::reloadConfig(); - g_pConfigManager->tick(); + // g_pConfigManager->tick(); + g_pAnimationManager->tick(); hyprfocus_log(LOG, "Reloaded config"); // Register callbacks From cb49355453007f275b9471ed2c5d6507ebdd4191 Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 22:26:49 +0100 Subject: [PATCH 11/19] Update hyprpm.toml --- hyprpm.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hyprpm.toml b/hyprpm.toml index cad415f..c5fc40d 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -1,17 +1,17 @@ [repository] name = "hyprfocus" -authors = ["VortexCoyote, OakleyCord, vaxerski, DRAGONTOS, pyt0xic"] +authors = ["VortexCoyote, OakleyCord, vaxerski, DRAGONTOS, pyt0xic, alyanser, noisethanks, avih7531"] [hyprfocus] description = "a focus animation plugin for Hyprland inspired by Flashfocus (pyt0xic fork)" -authors = ["VortexCoyote, OakleyCord, vaxerski, DRAGONTOS, pyt0xic"] +# authors = ["VortexCoyote, OakleyCord, vaxerski, DRAGONTOS, pyt0xic, alyanser, noisethanks, avih7531"] output = "hyprfocus.so" -commit_pins = [ - ["1c460e98f870676b15871fe4e5bfeb1a32a3d6d8", "2af0c1e87e3cdcef3c8f9c7def918982312d0b75"], - ["c5e28ebcfe00a510922779b2c568cfa52a317445", "c5e28ebcfe00a510922779b2c568cfa52a317445"], - ["0c513ba91bd73106be99e35b1a020d24e5ae874a", "e44b956dd4b7507489219bd2b02a3886d547b7e2"], - ["cba1ade848feac44b2eda677503900639581c3f4", "49dbe19e08f963e01ac4ba17b42719956d390ec7"], -] +# commit_pins = [ +# ["1c460e98f870676b15871fe4e5bfeb1a32a3d6d8", "2af0c1e87e3cdcef3c8f9c7def918982312d0b75"], +# ["c5e28ebcfe00a510922779b2c568cfa52a317445", "c5e28ebcfe00a510922779b2c568cfa52a317445"], +# ["0c513ba91bd73106be99e35b1a020d24e5ae874a", "e44b956dd4b7507489219bd2b02a3886d547b7e2"], +# ["cba1ade848feac44b2eda677503900639581c3f4", "49dbe19e08f963e01ac4ba17b42719956d390ec7"], +# ] build = [ "make all" ] From 227378fe742034c87a36fdb0681083da49bd6c99 Mon Sep 17 00:00:00 2001 From: daxis Date: Wed, 19 Feb 2025 23:14:48 +0100 Subject: [PATCH 12/19] Update README.md --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 04fc79b..b4c7215 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ hyprpm add https://github.com/pyt0xic/hyprfocus to start using hyprfocus, add this to your hyprland config: ``` +plugin { hyprfocus { enabled = yes animate_floating = yes @@ -55,6 +56,7 @@ to start using hyprfocus, add this to your hyprland config: out_speed = 2 } } +} ``` ### plugin configuration @@ -72,9 +74,11 @@ to start using hyprfocus, add this to your hyprland config: animations can be configured within the plugin scope with the following syntax: ``` -plugin:hyprfocus { - { +plugin { + hyprfocus { + { + } } } ``` From df9455e7aa9583c214b683242e61c36d4e272eab Mon Sep 17 00:00:00 2001 From: daxis Date: Tue, 1 Apr 2025 03:12:04 +0200 Subject: [PATCH 13/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4c7215..f300456 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # hyprfocus -a plugin which provides focus animations for us borderless folks, originally inspired by [flashfocus](https://github.com/fennerm/flashfocus)! +A plugin which provides focus animations for us borderless folks, originally inspired by [flashfocus](https://github.com/fennerm/flashfocus)! Modified to work with the latest Hyprland and support hyprpm as well as some other improvements. ## animations From cef70ba93d58b708a38ea760cdf78b5fdb60b693 Mon Sep 17 00:00:00 2001 From: daxis Date: Tue, 1 Apr 2025 03:18:07 +0200 Subject: [PATCH 14/19] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f300456..24e3217 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ plugin { bezier = smoothOut, 0.36, 0, 0.66, -0.56 bezier = smoothIn, 0.25, 1, 0.5, 1 bezier = realsmooth, 0.28,0.29,.69,1.08 + bezier = easeInOutBack, 0.68, -0.6, 0.32, 1.6 # Flash settings flash { flash_opacity = 0.95 From 8d978501772d744c338de6e29f2f2435e27092a2 Mon Sep 17 00:00:00 2001 From: daxis Date: Tue, 1 Apr 2025 03:20:13 +0200 Subject: [PATCH 15/19] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 24e3217..4280963 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ plugin { bezier = bezIn, 0.5,0.0,1.0,0.5 bezier = bezOut, 0.0,0.5,0.5,1.0 bezier = overshot, 0.05, 0.9, 0.1, 1.05 - bezier = smoothOut, 0.36, 0, 0.66, -0.56 bezier = smoothIn, 0.25, 1, 0.5, 1 + bezier = smoothOut, 0.36, 0, 0.66, -0.56 bezier = realsmooth, 0.28,0.29,.69,1.08 bezier = easeInOutBack, 0.68, -0.6, 0.32, 1.6 # Flash settings From 8061b05a04432da5331110e0ffaa8c81e1035725 Mon Sep 17 00:00:00 2001 From: daxis Date: Tue, 1 Apr 2025 03:29:38 +0200 Subject: [PATCH 16/19] Update README.md --- README.md | 58 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 4280963..63da7df 100644 --- a/README.md +++ b/README.md @@ -27,36 +27,36 @@ to start using hyprfocus, add this to your hyprland config: ``` plugin { - hyprfocus { - enabled = yes - animate_floating = yes - animate_workspacechange = yes - focus_animation = shrink - # Beziers for focus animations - bezier = bezIn, 0.5,0.0,1.0,0.5 - bezier = bezOut, 0.0,0.5,0.5,1.0 - bezier = overshot, 0.05, 0.9, 0.1, 1.05 - bezier = smoothIn, 0.25, 1, 0.5, 1 - bezier = smoothOut, 0.36, 0, 0.66, -0.56 - bezier = realsmooth, 0.28,0.29,.69,1.08 - bezier = easeInOutBack, 0.68, -0.6, 0.32, 1.6 - # Flash settings - flash { - flash_opacity = 0.95 - in_bezier = realsmooth - in_speed = 0.5 - out_bezier = realsmooth - out_speed = 3 - } - # Shrink settings - shrink { - shrink_percentage = 0.95 - in_bezier = realsmooth - in_speed = 1 - out_bezier = realsmooth - out_speed = 2 - } + hyprfocus { + enabled = yes + animate_floating = no + animate_workspacechange = no + focus_animation = flash + # Beziers for focus animations + bezier = bezIn, 0.5, 0.0, 1.0, 0.5 + bezier = bezOut, 0.0, 0.5, 0.5, 1.0 + bezier = overshot, 0.05, 0.9, 0.1, 1.05 + bezier = smoothOut, 0.36, 0, 0.66, -0.56 + bezier = smoothIn, 0.25, 1, 0.5, 1 + bezier = realsmooth, 0.28, 0.29, 0.69, 1.08 + bezier = easeInOutBack, 0.68, -0.6, 0.32, 1.6 + # Flash settings + flash { + flash_opacity = 0.7 + in_bezier = bezIn + in_speed = 0.5 + out_bezier = bezOut + out_speed = 3 + } + # Shrink settings + shrink { + shrink_percentage = 0.99 + in_bezier = easeInOutBack + in_speed = 1.5 + out_bezier = easeInOutBack + out_speed = 3 } + } } ``` From db98ec6ac912dfc030b5a0903266ff538d2022c6 Mon Sep 17 00:00:00 2001 From: daxis Date: Fri, 9 May 2025 16:27:48 +0200 Subject: [PATCH 17/19] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 63da7df..9548ee1 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ shrink instructions based on [the official wiki](https://wiki.hyprland.org/Plugins/Using-Plugins/#compiling-official-plugins) ``` -hyprpm add https://github.com/pyt0xic/hyprfocus +hyprpm add https://github.com/daxisunder/hyprfocus +hyprpm enable hyprfocus ``` ## getting started @@ -114,3 +115,4 @@ bind = $mod, space, animatefocused - [flashfocus](https://github.com/fennerm/flashfocus): An earlier project of similar nature - [Original repo](https://github.com/VortexCoyote/hyprfocus.git) +- [upstream](https://github.com/pyt0xic/hyprfocus) From 30acd6c81fd167362b5ea028566e57a111b60c7d Mon Sep 17 00:00:00 2001 From: Avi Herman Date: Thu, 15 May 2025 03:38:42 -0400 Subject: [PATCH 18/19] fix: update Hyprland window class member variable names --- src/Flash.cpp | 13 +++++-------- src/Shrink.cpp | 18 +++++++++--------- src/main.cpp | 2 +- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/Flash.cpp b/src/Flash.cpp index 917a65b..0d72bb7 100644 --- a/src/Flash.cpp +++ b/src/Flash.cpp @@ -33,17 +33,14 @@ void CFlash::onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle) { static const auto *flash_opacity = (Hyprlang::FLOAT *const *)(getConfigValue(pHandle, "flash_opacity") ->getDataStaticPtr()); - *pWindow->m_fAlpha = **flash_opacity; - // pWindow->m_fAlpha = g_fFlashOpacity; - pWindow->m_fAlpha->setConfig(m_sFocusInAnimConfig); - pWindow->m_fAlpha->setCallbackOnEnd([this, pWindow, pHandle](CWeakPointer pAnim) { + *pWindow->m_alpha = **flash_opacity; + pWindow->m_alpha->setConfig(m_sFocusInAnimConfig); + pWindow->m_alpha->setCallbackOnEnd([this, pWindow, pHandle](CWeakPointer pAnim) { static const auto *active_opacity = (Hyprlang::FLOAT *const *)(HyprlandAPI::getConfigValue( pHandle, "decoration:active_opacity") ->getDataStaticPtr()); - // Make sure we restore to the active window opacity - *pWindow->m_fAlpha = **active_opacity; - // pWindow->m_fAlpha = g_fActiveOpacity; - pWindow->m_fAlpha->setConfig(m_sFocusOutAnimConfig); + *pWindow->m_alpha = **active_opacity; + pWindow->m_alpha->setConfig(m_sFocusOutAnimConfig); }); } diff --git a/src/Shrink.cpp b/src/Shrink.cpp index 9be10ea..7e46cf9 100644 --- a/src/Shrink.cpp +++ b/src/Shrink.cpp @@ -22,18 +22,18 @@ void CShrink::setup(HANDLE pHandle, std::string animationName) { void CShrink::onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle) { std::string currentAnimStyle = - pWindow->m_vRealSize->getConfig()->internalStyle; + pWindow->m_realSize->getConfig()->internalStyle; hyprfocus_log(LOG, "Current animation style: {}", currentAnimStyle); if ((currentAnimStyle == "popout" || currentAnimStyle == "popin") && - pWindow->m_vRealSize->isBeingAnimated()) { + pWindow->m_realSize->isBeingAnimated()) { hyprfocus_log(LOG, "Shrink: Window is already being animated, skipping"); return; } IFocusAnimation::onWindowFocus(pWindow, pHandle); - pWindow->m_vRealSize->setConfig(m_sFocusOutAnimConfig); - pWindow->m_vRealPosition->setConfig(m_sFocusOutAnimConfig); + pWindow->m_realSize->setConfig(m_sFocusOutAnimConfig); + pWindow->m_realPosition->setConfig(m_sFocusOutAnimConfig); g_pAnimationManager->createAnimation(1.0f, m_sShrinkAnimation, m_sFocusOutAnimConfig, pWindow, AVARDAMAGE_ENTIRE); @@ -46,15 +46,15 @@ void CShrink::onWindowFocus(PHLWINDOW pWindow, HANDLE pHandle) { m_sShrinkAnimation->setUpdateCallback( [this, pWindow](CWeakPointer pShrinkAnimation) { - const auto GOALPOS = pWindow->m_vRealPosition->goal(); - const auto GOALSIZE = pWindow->m_vRealSize->goal(); + const auto GOALPOS = pWindow->m_realPosition->goal(); + const auto GOALSIZE = pWindow->m_realSize->goal(); const auto *PANIMATION = (CAnimatedVariable *)pShrinkAnimation.get(); - pWindow->m_vRealSize->setValue(GOALSIZE * PANIMATION->value()); - pWindow->m_vRealPosition->setValue(GOALPOS + GOALSIZE / 2.f - - pWindow->m_vRealSize->value() / 2.f); + pWindow->m_realSize->setValue(GOALSIZE * PANIMATION->value()); + pWindow->m_realPosition->setValue(GOALPOS + GOALSIZE / 2.f - + pWindow->m_realSize->value() / 2.f); }); m_sShrinkAnimation->setCallbackOnEnd( diff --git a/src/main.cpp b/src/main.cpp index e41c8cd..1769a9d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -128,7 +128,7 @@ static void onActiveWindowChange(void *self, std::any data) { return; } - if (PWINDOW->m_bIsFloating && !**PANIMATEFLOATING) { + if (PWINDOW->m_isFloating && !**PANIMATEFLOATING) { hyprfocus_log(LOG, "Floating window, not animating"); g_pPreviouslyFocusedWindow = PWINDOW; return; From 89a274d028fa6c6037112339c440fc2b69931891 Mon Sep 17 00:00:00 2001 From: Avi Herman Date: Tue, 16 Sep 2025 16:12:37 -0400 Subject: [PATCH 19/19] cache overhead --- src/Flash.cpp | 2 +- src/Shrink.cpp | 2 +- src/main.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Flash.cpp b/src/Flash.cpp index 0d72bb7..2fbb9c6 100644 --- a/src/Flash.cpp +++ b/src/Flash.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include void CFlash::init(HANDLE pHandle, std::string animationName) { diff --git a/src/Shrink.cpp b/src/Shrink.cpp index 7e46cf9..30964a5 100644 --- a/src/Shrink.cpp +++ b/src/Shrink.cpp @@ -3,7 +3,7 @@ #include "Log.hpp" #include #include -#include +#include #include void CShrink::init(HANDLE pHandle, std::string animationName) { diff --git a/src/main.cpp b/src/main.cpp index 1769a9d..5d1f4c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include "Flash.hpp" #include "Shrink.hpp"