VortexCoyote / hyprfocus

a focus animation plugin for Hyprland inspired by Flashfocus
BSD 3-Clause "New" or "Revised" License
168 stars 14 forks source link

Build error #18

Closed daxisunder closed 5 months ago

daxisunder commented 6 months ago

On hyprland-git 0.35.0.r96.54a83299-1

swappy-20240227-130457 swappy-20240227-130646

With hyprpm

swappy-20240227-163855

daxisunder commented 6 months ago

I managed to build it, but now it crashes Hyprland.


Hyprland Crash Report

Who tried dividing by zero?!

Hyprland received signal 6 (Aborted)

Version: 21f7f32dc98521025cea76e530204ea64f2630f0 Tag: v0.35.0-106-g21f7f32d

Hyprland seems to be running with plugins. This crash might not be Hyprland's fault. Plugins: ()

System info: System name: Linux Node name: archlinux Release: 6.7.6-arch1-2 Version: #1 SMP PREEMPT_DYNAMIC Thu, 29 Feb 2024 19:08:51 +0000

GPU: 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GP108 [GeForce GT 1030] [10de:1d01] (rev a1) (prog-if 00 [VGA controller])

os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo

Backtrace:

0 | Hyprland(_Z12getBacktracev+0x62) [0x6420c0d07ee2]

    getBacktrace()
    ??:?
#1 | Hyprland(_ZN13CrashReporter18createAndSaveCrashEi+0x6d3) [0x6420c0cccce3]
    CrashReporter::createAndSaveCrash(int)
    ??:?
#2 | Hyprland(_Z25handleUnrecoverableSignali+0x48) [0x6420c0c64098]
    handleUnrecoverableSignal(int)
    ??:?
#3 | /usr/lib/libc.so.6(+0x3c770) [0x78452a45a770]
    ??
    ??:0
#4 | /usr/lib/libc.so.6(+0x8d32c) [0x78452a4ab32c]
    ??
    ??:0
#5 | /usr/lib/libc.so.6(gsignal+0x18) [0x78452a45a6c8]
    ??
    ??:0
#6 | /usr/lib/libc.so.6(abort+0xd7) [0x78452a4424b8]
    ??
    ??:0
#7 | /usr/lib/libstdc++.so.6(+0x9ca6f) [0x78452a69ca6f]
    main
    ??:?
#8 | /usr/lib/libstdc++.so.6(+0xb011c) [0x78452a6b011c]
    CCompositor::startCompositor()
    ??:?
#9 | /usr/lib/libstdc++.so.6(+0xb0189) [0x78452a6b0189]
    CCompositor::startCompositor()
    ??:?
#10 | /usr/lib/libstdc++.so.6(__cxa_rethrow+0x4f) [0x78452a6b043f]
    CCompositor::startCompositor()
    ??:?
#11 | /usr/lib/libhyprlang.so.1(+0x79d3) [0x78452ab629d3]
    ??
    ??:0
#12 | /usr/lib/libhyprlang.so.1(_ZN8Hyprlang7CConfig21addSpecialConfigValueEPKcS2_RKNS_12CConfigValueE+0x541) [0x78452ab67cd1]
    ??
    ??:0
#13 | Hyprland(_ZN14CConfigManager18addPluginConfigVarEPvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKN8Hyprlang12CConfigValueE+0x9f) [0x6420c0caeb8f]
    CConfigManager::addPluginConfigVar(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Hyprlang::CConfigValue const&)
    ??:?
#14 | Hyprland(addConfigValue+0x7e) [0x6420c0d5df3e]
    addConfigValue
    ??:?
#15 | /home/daxis/hyprfocus/hyprfocus.so(pluginInit+0x11f) [0x78452811377e]
    ??
    ??:0
#16 | Hyprland(_ZN13CPluginSystem10loadPluginERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x336) [0x6420c0d61766]
    CPluginSystem::loadPlugin(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
    ??:?
#17 | Hyprland(_Z14dispatchPlugin20eHyprCtlOutputFormatNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x397) [0x6420c0ce4c37]
    dispatchPlugin(eHyprCtlOutputFormat, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
    ??:?
#18 | Hyprland(_ZNSt17_Function_handlerIFNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE20eHyprCtlOutputFormatS5_EPS7_E9_M_invokeERKSt9_Any_dataOS6_OS5_+0x70) [0x6420c0cdeb30]
    std::_Function_handler<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (eHyprCtlOutputFormat, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >), std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (*)(eHyprCtlOutputFormat, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>::_M_invoke(std::_Any_data const&, eHyprCtlOutputFormat&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
    ??:?
#19 | Hyprland(_ZN8CHyprCtl8getReplyENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x2fc) [0x6420c0ce1d1c]
    CHyprCtl::getReply(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
    ??:?
#20 | Hyprland(_Z13hyprCtlFDTickijPv+0x371) [0x6420c0ce7911]
    hyprCtlFDTick(int, unsigned int, void*)
    ??:?
#21 | /usr/lib/libwayland-server.so.0(wl_event_loop_dispatch+0xa2) [0x78452ae7cae2]
    ??
    ??:0
#22 | /usr/lib/libwayland-server.so.0(wl_display_run+0x27) [0x78452ae7d2d7]
    ??
    ??:0
#23 | Hyprland(main+0x7fa) [0x6420c0c4cb4a]
    main
    ??:?
#24 | /usr/lib/libc.so.6(+0x25cd0) [0x78452a443cd0]
    ??
    ??:0
#25 | /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x78452a443d8a]
    ??
    ??:0
#26 | Hyprland(_start+0x25) [0x6420c0c617e5]
    _start
    ??:?

Log tail: [LOG] CWLSurface 6420c1d13938 called init() [LOG] Registered signal for owner 6420c1d130b0: 6420c1d10f08 -> 6420c1d13180 (owner: CWindow) [LOG] Searching for matching rules for kitty (title: bash) [LOG] Window rule opacity 0.9 0.9 -> class:^(kitty)$ matched [Window 6420c1d130b0: title: "bash"] [LOG] OPENINGON: [Node nullptr], Monitor: 0 [LOG] Set keyboard focus to surface 6420c1d10c10, with [Window 6420c1d130b0: title: "bash"] [LOG] Searching for matching rules for kitty (title: bash) [LOG] Window rule opacity 0.9 0.9 -> class:^(kitty)$ matched [Window 6420c1d130b0: title: "bash"] [LOG] [hookSystem] New hook event registered: activeWindow [LOG] Window got assigned a surfaceTreeNode 0 [LOG] Registered signal for owner 6420c1d130b0: 6420c1cb1708 -> 6420c1d13250 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1d110c8 -> 6420c1d13388 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1cb1698 -> 6420c1d134c0 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1cb16b8 -> 6420c1d13458 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1cb16c8 -> 6420c1d133f0 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1cb16d8 -> 6420c1d13528 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1cb16a8 -> 6420c1d13320 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1d130b0: 6420c1d110e8 -> 6420c1d138d0 (owner: XDG Window Late) [LOG] Registered signal for owner 6420c1810250: 6420c1d10f18 -> 6420c18102e8 (owner: SurfaceTreeNode) [LOG] Registered signal for owner 6420c1810250: 6420c1d10ee8 -> 6420c1810350 (owner: SurfaceTreeNode) [LOG] Registered signal for owner 6420c1810250: 6420c1d10f28 -> 6420c18103b8 (owner: SurfaceTreeNode) [LOG] Creating a surfaceTree Root! [Window 6420c1d130b0: title: "bash"] [LOG] Map request dispatched, monitor HDMI-A-1, window pos: [6.00000, 45.00000], window size: [1908.00000, 1029.00000] [LOG] Searching for matching rules for kitty (title: bash) [LOG] Window rule opacity 0.9 0.9 -> class:^(kitty)$ matched [Window 6420c1d130b0: title: "bash"] [LOG] Framebuffer created, status 36053 [LOG] cursorImage request: surface 6420c1d10820 [LOG] Registered signal for owner 6420c168cc58: 6420c1d10b38 -> 6420c168cc80 (owner: CWLSurface) [LOG] CWLSurface 6420c168cc58 called init() [LOG] cursorImage request: surface 6420c1d10820 [LOG] cursorImage request: surface 6420c1d10820 [LOG] [hookSystem] New hook event registered: windowTitle [LOG] Searching for matching rules for kitty (title: Zellij (vitreous-hill) - Pane #1) [LOG] Window rule opacity 0.9 0.9 -> class:^(kitty)$ matched [Window 6420c1d130b0: title: "Zellij (vitreous-hill) - Pane #1"] [LOG] Window 6420c1d130b0 set title to Zellij (vitreous-hill) - Pane #1 [LOG] Searching for matching rules for kitty (title: Zellij (vitreous-hill) - daxis@archlinux:~) [LOG] Window rule opacity 0.9 0.9 -> class:^(kitty)$ matched [Window 6420c1d130b0: title: "Zellij (vitreous-hill) - daxis@archlinux:~"] [LOG] Window 6420c1d130b0 set title to Zellij (vitreous-hill) - daxis@archlinux:~ [LOG] Searching for matching rules for kitty (title: Zellij (vitreous-hill) - ~) [LOG] Window rule opacity 0.9 0.9 -> class:^(kitty)$ matched [Window 6420c1d130b0: title: "Zellij (vitreous-hill) - ~"] [LOG] Window 6420c1d130b0 set title to Zellij (vitreous-hill) - ~ [LOG] cursorImage request: surface 0 [LOG] Callback 6420c168cca8 -> 6420c168cca0, CWLSurface removed. [LOG] CWLSurface 6420c168cc58 called destroy() [LOG] cursorImage request: surface 6420c1d10820 [LOG] Registered signal for owner 6420c168cc58: 6420c1d10b38 -> 6420c168cc80 (owner: CWLSurface) [LOG] CWLSurface 6420c168cc58 called init() [LOG] cursorImage request: surface 6420c1d10820 [LOG] cursorImage request: surface 6420c1d10820 [LOG] cursorImage request: surface 0 [LOG] Callback 6420c168cca8 -> 6420c168cca0, CWLSurface removed. [LOG] CWLSurface 6420c168cc58 called destroy()

DRAGONTOS commented 6 months ago

This is cus of the recent change to hyprlang for config management, it should be an easy fix but I doubt that they are gonna update this plugin since i think that their focus is on smth else.

daxisunder commented 6 months ago

Oh, crap. Do you happen to know what is the latest supported version of Hyprland?

pyt0xic commented 6 months ago

My fork is working with the latest build of Hyprland.

It can be added with hyprpm add https://github.com/pyt0xic/hyprfocus and enabled with
hyprpm enable hyprfocus

The keyboard and mouse specific config values have been replaced with focus_animation, for example

hyprfocus {
    enabled = yes
    focus_animation = flash
    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0
    flash {
        flash_opacity = 0.7
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
    shrink {
        shrink_percentage = 0.8
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
}

PS. I am a C++ noob and that will be obvious if you were to take a look at the changes I made.

daxisunder commented 6 months ago

Nope. Sorry, but it won't build. At least it doesn't crash Hyprland as soon as I add the code snippet to my config. swappy-20240304-112103

pyt0xic commented 6 months ago

Nope. Sorry, but it won't build. At least it doesn't crash Hyprland as soon as I add the code snippet to my config. swappy-20240304-112103

What version of hyprland are you using? I think you need to might need to update the hyprland headers... I am using the aur/hyprland-git package.

What happens if you try clone and build with make all ?

Can you add the official plugin repo with hyprpm?

daxisunder commented 6 months ago

What version of hyprland are you using? I think you need to might need to update the hyprland headers... I am using the aur/hyprland-git package.

The same package, I tried versions 0.35.0 and 0.36.0, headers are updated. The last I had it working was on hyprland-nvidia-git 0.28.0. What happens if you try clone and build with make all ?

It builds without errors, unlike the official repo (see the screenshot in my first comment) but it crashes Hyprland as soon as I run hyprctl plugin load /home/daxis/hyprfocus/hyprfocus.so Can you add the official plugin repo with hyprpm?

Hyprpm adds the official repo, just as this one, runs and throws an error plugin hyprfocus failed to build and says that it can't find some files as you can see in the screenshot in my first comment and hyprpm list doesn't show it. With this repo it adds it, throws plugin hyprfocus failed to build but not the files error and hyprpm list shows it as enabled: plugin failed to build as seen in the screenshot in my previous comment. I tried another plugin, hycov, hyprpm says that it's built and lists it correctly, but it crashes Hyprland as soon as I add the code snippet to my config and save.

obmutescences commented 6 months ago

My fork is working with the latest build of Hyprland.

It can be added with hyprpm add https://github.com/pyt0xic/hyprfocus and enabled with hyprpm enable hyprfocus

The keyboard and mouse specific config values have been replaced with focus_animation, for example

hyprfocus {
    enabled = yes
    focus_animation = flash
    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0
    flash {
        flash_opacity = 0.7
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
    shrink {
        shrink_percentage = 0.8
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
}

PS. I am a C++ noob and that will be obvious if you were to take a look at the changes I made.

clone you fork. make all. not working. In file included from src/main.cpp:13: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ In file included from src/Shrink.cpp:1: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ src/Shrink.cpp: In member function ‘virtual void CShrink::onWindowFocus(CWindow, void)’: src/Shrink.cpp:39:28: error: no matching function for call to ‘CAnimatedVariable::create(float, SAnimationPropertyConfig, CWindow&, AVARDAMAGEPOLICY)’ 39 | m_sShrinkAnimation.create(1.0f, &m_sFocusInAnimConfig, pWindow, | ~~~~~^~~~~~~~~~ 40 | AVARDAMAGE_ENTIRE); | ~~~~~~ In file included from /usr/local/include/hyprland/src/Window.hpp:5, from /usr/local/include/hyprland/src/config/ConfigManager.hpp:16, from src/IFocusAnimation.hpp:6, from src/Shrink.hpp:1: /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:17: note: no known conversion for argument 1 from ‘float’ to ‘ANIMATEDVARTYPE’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~~~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, std::any, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 36 | void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate expects 5 arguments, 4 provided src/Shrink.cpp: In lambda function: src/Shrink.cpp:44:51: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 44 | const auto GOALPOS = pWindow->m_vRealPosition.goal(); | ^~~~ | goalv src/Shrink.cpp:45:48: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 45 | const auto GOALSIZE = pWindow->m_vRealSize.goal(); | ^~~~ | goalv src/Shrink.cpp:47:31: error: ‘CAnimatedVariable’ is not a template 47 | const auto PANIMATION = (CAnimatedVariable )pShrinkAnimation; | ^~~~~ src/Shrink.cpp:49:58: error: ‘const class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 49 | pWindow->m_vRealSize.setValue(GOALSIZE PANIMATION->value()); | ^~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~~~ src/Shrink.cpp:51:60: error: ‘class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 51 | pWindow->m_vRealSize.value() / 2.f); | ^~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~~~ src/Shrink.cpp: In lambda function: src/Shrink.cpp:55:7: error: ‘CAnimatedVariable’ is not a template 55 | ((CAnimatedVariable )pShrinkAnimation)->resetAllCallbacks(); | ^~~~~ make: *** [Makefile:4: all] Error 1

pyt0xic commented 6 months ago

My fork is working with the latest build of Hyprland. It can be added with hyprpm add https://github.com/pyt0xic/hyprfocus and enabled with hyprpm enable hyprfocus The keyboard and mouse specific config values have been replaced with focus_animation, for example

hyprfocus {
    enabled = yes
    focus_animation = flash
    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0
    flash {
        flash_opacity = 0.7
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
    shrink {
        shrink_percentage = 0.8
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
}

PS. I am a C++ noob and that will be obvious if you were to take a look at the changes I made.

clone you fork. make all. not working. In file included from src/main.cpp:13: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ In file included from src/Shrink.cpp:1: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ src/Shrink.cpp: In member function ‘virtual void CShrink::onWindowFocus(CWindow, void)’: src/Shrink.cpp:39:28: error: no matching function for call to ‘CAnimatedVariable::create(float, SAnimationPropertyConfig, CWindow&, AVARDAMAGEPOLICY)’ 39 | m_sShrinkAnimation.create(1.0f, &m_sFocusInAnimConfig, pWindow, | ~~~~~^~~~~~~~~~ 40 | AVARDAMAGE_ENTIRE); | ~~~~ In file included from /usr/local/include/hyprland/src/Window.hpp:5, from /usr/local/include/hyprland/src/config/ConfigManager.hpp:16, from src/IFocusAnimation.hpp:6, from src/Shrink.hpp:1: /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:17: note: no known conversion for argument 1 from ‘float’ to ‘ANIMATEDVARTYPE’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, std::any, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 36 | void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate expects 5 arguments, 4 provided src/Shrink.cpp: In lambda function: src/Shrink.cpp:44:51: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 44 | const auto GOALPOS = pWindow->m_vRealPosition.goal(); | ^~ | goalv src/Shrink.cpp:45:48: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 45 | const auto GOALSIZE = pWindow->m_vRealSize.goal(); | ^~ | goalv src/Shrink.cpp:47:31: error: ‘CAnimatedVariable’ is not a template 47 | const auto PANIMATION = (CAnimatedVariable )pShrinkAnimation; | ^~~~~ src/Shrink.cpp:49:58: error: ‘const class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 49 | pWindow->m_vRealSize.setValue(GOALSIZE PANIMATION->value()); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp:51:60: error: ‘class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 51 | pWindow->m_vRealSize.value() / 2.f); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp: In lambda function: src/Shrink.cpp:55:7: error: ‘CAnimatedVariable’ is not a template 55 | ((CAnimatedVariable )pShrinkAnimation)->resetAllCallbacks(); | ^~~~~ make: *** [Makefile:4: all] Error 1

I just realized those changes to CAnimatedVariable in Hyprland are not in the latest release yet.

Please try with the latest Hyprland commit, shrink is not working properly as yet but flash works fine.

I might revert these changes so long...

obmutescences commented 6 months ago

My fork is working with the latest build of Hyprland. It can be added with hyprpm add https://github.com/pyt0xic/hyprfocus and enabled with hyprpm enable hyprfocus The keyboard and mouse specific config values have been replaced with focus_animation, for example

hyprfocus {
    enabled = yes
    focus_animation = flash
    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0
    flash {
        flash_opacity = 0.7
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
    shrink {
        shrink_percentage = 0.8
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
}

PS. I am a C++ noob and that will be obvious if you were to take a look at the changes I made.

clone you fork. make all. not working. In file included from src/main.cpp:13: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ In file included from src/Shrink.cpp:1: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ src/Shrink.cpp: In member function ‘virtual void CShrink::onWindowFocus(CWindow, void)’: src/Shrink.cpp:39:28: error: no matching function for call to ‘CAnimatedVariable::create(float, SAnimationPropertyConfig, CWindow&, AVARDAMAGEPOLICY)’ 39 | m_sShrinkAnimation.create(1.0f, &m_sFocusInAnimConfig, pWindow, | ~~~~~^~~~~~~~~~ 40 | AVARDAMAGE_ENTIRE); | ~~~~ In file included from /usr/local/include/hyprland/src/Window.hpp:5, from /usr/local/include/hyprland/src/config/ConfigManager.hpp:16, from src/IFocusAnimation.hpp:6, from src/Shrink.hpp:1: /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:17: note: no known conversion for argument 1 from ‘float’ to ‘ANIMATEDVARTYPE’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, std::any, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 36 | void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate expects 5 arguments, 4 provided src/Shrink.cpp: In lambda function: src/Shrink.cpp:44:51: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 44 | const auto GOALPOS = pWindow->m_vRealPosition.goal(); | ^~ | goalv src/Shrink.cpp:45:48: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 45 | const auto GOALSIZE = pWindow->m_vRealSize.goal(); | ^~ | goalv src/Shrink.cpp:47:31: error: ‘CAnimatedVariable’ is not a template 47 | const auto PANIMATION = (CAnimatedVariable )pShrinkAnimation; | ^~~~~ src/Shrink.cpp:49:58: error: ‘const class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 49 | pWindow->m_vRealSize.setValue(GOALSIZE PANIMATION->value()); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp:51:60: error: ‘class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 51 | pWindow->m_vRealSize.value() / 2.f); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp: In lambda function: src/Shrink.cpp:55:7: error: ‘CAnimatedVariable’ is not a template 55 | ((CAnimatedVariable )pShrinkAnimation)->resetAllCallbacks(); | ^~~~~ make: *** [Makefile:4: all] Error 1

I just realized those changes to CAnimatedVariable in Hyprland are not in the latest release yet.

Please try with the latest Hyprland commit, shrink is not working properly as yet but flash works fine.

I might revert these changes so long...

thanks for reply.

I use hyprland-git 0.36.0. can not use shrink? but shrink its i want. waiting hyprland to update then can use shrink?

pyt0xic commented 6 months ago

My fork is working with the latest build of Hyprland. It can be added with hyprpm add https://github.com/pyt0xic/hyprfocus and enabled with hyprpm enable hyprfocus The keyboard and mouse specific config values have been replaced with focus_animation, for example

hyprfocus {
    enabled = yes
    focus_animation = flash
    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0
    flash {
        flash_opacity = 0.7
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
    shrink {
        shrink_percentage = 0.8
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
}

PS. I am a C++ noob and that will be obvious if you were to take a look at the changes I made.

clone you fork. make all. not working. In file included from src/main.cpp:13: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ In file included from src/Shrink.cpp:1: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ src/Shrink.cpp: In member function ‘virtual void CShrink::onWindowFocus(CWindow, void)’: src/Shrink.cpp:39:28: error: no matching function for call to ‘CAnimatedVariable::create(float, SAnimationPropertyConfig, CWindow&, AVARDAMAGEPOLICY)’ 39 | m_sShrinkAnimation.create(1.0f, &m_sFocusInAnimConfig, pWindow, | ~~~~~^~~~~~~~~~ 40 | AVARDAMAGE_ENTIRE); | ~~~~ In file included from /usr/local/include/hyprland/src/Window.hpp:5, from /usr/local/include/hyprland/src/config/ConfigManager.hpp:16, from src/IFocusAnimation.hpp:6, from src/Shrink.hpp:1: /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:17: note: no known conversion for argument 1 from ‘float’ to ‘ANIMATEDVARTYPE’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, std::any, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 36 | void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate expects 5 arguments, 4 provided src/Shrink.cpp: In lambda function: src/Shrink.cpp:44:51: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 44 | const auto GOALPOS = pWindow->m_vRealPosition.goal(); | ^~ | goalv src/Shrink.cpp:45:48: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 45 | const auto GOALSIZE = pWindow->m_vRealSize.goal(); | ^~ | goalv src/Shrink.cpp:47:31: error: ‘CAnimatedVariable’ is not a template 47 | const auto PANIMATION = (CAnimatedVariable )pShrinkAnimation; | ^~~~~ src/Shrink.cpp:49:58: error: ‘const class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 49 | pWindow->m_vRealSize.setValue(GOALSIZE PANIMATION->value()); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp:51:60: error: ‘class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 51 | pWindow->m_vRealSize.value() / 2.f); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp: In lambda function: src/Shrink.cpp:55:7: error: ‘CAnimatedVariable’ is not a template 55 | ((CAnimatedVariable )pShrinkAnimation)->resetAllCallbacks(); | ^~~~~ make: *** [Makefile:4: all] Error 1

I just realized those changes to CAnimatedVariable in Hyprland are not in the latest release yet. Please try with the latest Hyprland commit, shrink is not working properly as yet but flash works fine. I might revert these changes so long...

thanks for reply.

I use hyprland-git 0.36.0. can not use shrink? but shrink its i want. waiting hyprland to update then can use shrink?

I will push a fix for shrink shortly, its also all I use.

Just in a meeting at the moment haha.

Alternatively I can revert these changes and only support the 0.36.0 release, shrink was working with that.

obmutescences commented 6 months ago

My fork is working with the latest build of Hyprland. It can be added with hyprpm add https://github.com/pyt0xic/hyprfocus and enabled with hyprpm enable hyprfocus The keyboard and mouse specific config values have been replaced with focus_animation, for example

hyprfocus {
    enabled = yes
    focus_animation = flash
    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0
    flash {
        flash_opacity = 0.7
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
    shrink {
        shrink_percentage = 0.8
        in_bezier = bezIn
        in_speed = 0.5
        out_bezier = bezOut
        out_speed = 3
    }
}

PS. I am a C++ noob and that will be obvious if you were to take a look at the changes I made.

clone you fork. make all. not working. In file included from src/main.cpp:13: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ In file included from src/Shrink.cpp:1: src/Shrink.hpp:9:3: error: ‘CAnimatedVariable’ is not a template 9 | CAnimatedVariable m_sShrinkAnimation; | ^~~~~ src/Shrink.cpp: In member function ‘virtual void CShrink::onWindowFocus(CWindow, void)’: src/Shrink.cpp:39:28: error: no matching function for call to ‘CAnimatedVariable::create(float, SAnimationPropertyConfig, CWindow&, AVARDAMAGEPOLICY)’ 39 | m_sShrinkAnimation.create(1.0f, &m_sFocusInAnimConfig, pWindow, | ~~~~~^~~~~~~~~~ 40 | AVARDAMAGE_ENTIRE); | ~~~~ In file included from /usr/local/include/hyprland/src/Window.hpp:5, from /usr/local/include/hyprland/src/config/ConfigManager.hpp:16, from src/IFocusAnimation.hpp:6, from src/Shrink.hpp:1: /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:35:17: note: no known conversion for argument 1 from ‘float’ to ‘ANIMATEDVARTYPE’ 35 | void create(ANIMATEDVARTYPE, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~~~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate: ‘void CAnimatedVariable::create(ANIMATEDVARTYPE, std::any, SAnimationPropertyConfig, void, AVARDAMAGEPOLICY)’ 36 | void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig, void pWindow, AVARDAMAGEPOLICY); | ^~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:36:10: note: candidate expects 5 arguments, 4 provided src/Shrink.cpp: In lambda function: src/Shrink.cpp:44:51: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 44 | const auto GOALPOS = pWindow->m_vRealPosition.goal(); | ^~ | goalv src/Shrink.cpp:45:48: error: ‘class CAnimatedVariable’ has no member named ‘goal’; did you mean ‘goalv’? 45 | const auto GOALSIZE = pWindow->m_vRealSize.goal(); | ^~ | goalv src/Shrink.cpp:47:31: error: ‘CAnimatedVariable’ is not a template 47 | const auto PANIMATION = (CAnimatedVariable )pShrinkAnimation; | ^~~~~ src/Shrink.cpp:49:58: error: ‘const class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 49 | pWindow->m_vRealSize.setValue(GOALSIZE PANIMATION->value()); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp:51:60: error: ‘class CAnimatedVariable’ has no member named ‘value’; did you mean ‘Vector2D CAnimatedVariable::m_vValue’? (not accessible from this context) 51 | pWindow->m_vRealSize.value() / 2.f); | ^~~ /usr/local/include/hyprland/src/helpers/AnimatedVariable.hpp:249:14: note: declared private here 249 | Vector2D m_vValue = Vector2D(0, 0); | ^~ src/Shrink.cpp: In lambda function: src/Shrink.cpp:55:7: error: ‘CAnimatedVariable’ is not a template 55 | ((CAnimatedVariable )pShrinkAnimation)->resetAllCallbacks(); | ^~~~~ make: *** [Makefile:4: all] Error 1

I just realized those changes to CAnimatedVariable in Hyprland are not in the latest release yet. Please try with the latest Hyprland commit, shrink is not working properly as yet but flash works fine. I might revert these changes so long...

thanks for reply. I use hyprland-git 0.36.0. can not use shrink? but shrink its i want. waiting hyprland to update then can use shrink?

I will push a fix for shrink shortly, its also all I use.

Just in a meeting at the moment haha.

Alternatively I can revert these changes and only support the 0.36.0 release, shrink was working with that.

Ok. cool!

pyt0xic commented 6 months ago

@obmutescences I reverted the changes and tested on a clean build of 0.36.0 and shrink is working again.

I did the following to install Hyprland:

git clone git@github.com:hyprwm/hyprland.git --recursive && cd hyprland/
git checkout v0.36.0
make all
sudo make install && sudo make installheaders

then I rebooted and ran:

hyprpm remove https://github.com/pyt0xic/hyprfocus # if still installed
hyprpm update
hyprpm add https://github.com/pyt0xic/hyprfocus -v
hyprpm enable hyprfocus -v

I think I'll wait until the next Hyprland release before updating the plugin.

Let me know if it works for you!

daxisunder commented 6 months ago

I can't clone git@github.com:hyprwm/hyprland.git, I don't have access rights. Otherwise, it does the same thing, if I build manually it crashes Hyprland when I run hyprctl plugin load hyprfocus, and with hyprpm it throws this: swappy-20240306-012533 swappy-20240306-012642

obmutescences commented 6 months ago

@obmutescences I reverted the changes and tested on a clean build of 0.36.0 and shrink is working again.

I did the following to install Hyprland:

git clone git@github.com:hyprwm/hyprland.git --recursive && cd hyprland/
git checkout v0.36.0
make all
sudo make install && sudo make installheaders

then I rebooted and ran:

hyprpm remove https://github.com/pyt0xic/hyprfocus # if still installed
hyprpm update
hyprpm add https://github.com/pyt0xic/hyprfocus -v
hyprpm enable hyprfocus -v

I think I'll wait until the next Hyprland release before updating the plugin.

Let me know if it works for you!

follow this steps no errors. can enable hyprfocus. but shrink not working

daxisunder commented 6 months ago

I can't clone git@github.com:hyprwm/hyprland.git, I don't have access rights.

pyt0xic commented 6 months ago

@obmutescences I reverted the changes and tested on a clean build of 0.36.0 and shrink is working again. I did the following to install Hyprland:

git clone git@github.com:hyprwm/hyprland.git --recursive && cd hyprland/
git checkout v0.36.0
make all
sudo make install && sudo make installheaders

then I rebooted and ran:

hyprpm remove https://github.com/pyt0xic/hyprfocus # if still installed
hyprpm update
hyprpm add https://github.com/pyt0xic/hyprfocus -v
hyprpm enable hyprfocus -v

I think I'll wait until the next Hyprland release before updating the plugin. Let me know if it works for you!

follow this steps no errors. can enable hyprfocus. but shrink not working

Could you share your hyprfocus config?

And does flash work?

pyt0xic commented 6 months ago

I can't clone git@github.com:hyprwm/hyprland.git, I don't have access rights.

Try use the https url:

git clone https://github.com/hyprwm/hyprland.git --recursive
obmutescences commented 6 months ago

@obmutescences I reverted the changes and tested on a clean build of 0.36.0 and shrink is working again. I did the following to install Hyprland:

git clone git@github.com:hyprwm/hyprland.git --recursive && cd hyprland/
git checkout v0.36.0
make all
sudo make install && sudo make installheaders

then I rebooted and ran:

hyprpm remove https://github.com/pyt0xic/hyprfocus # if still installed
hyprpm update
hyprpm add https://github.com/pyt0xic/hyprfocus -v
hyprpm enable hyprfocus -v

I think I'll wait until the next Hyprland release before updating the plugin. Let me know if it works for you!

follow this steps no errors. can enable hyprfocus. but shrink not working

Could you share your hyprfocus config?

And does flash work?

I changed config same as you repo.

pyt0xic commented 6 months ago

Here is a video of shrink working on hyprland v0.36.0

And my hyprfocus config:

     hyprfocus {
        enabled = yes
        focus_animation = shrink
        bezier = bezIn, 0.5,0.0,1.0,0.5
        bezier = bezOut, 0.0,0.5,0.5,1.0
        # Flash settings
        flash {
            flash_opacity = 0.99
            in_bezier = bezIn
            in_speed = 0.5
            out_bezier = bezOut
            out_speed = 3
        }
        # Shrink settings
        shrink {
            shrink_percentage = 0.98
            in_bezier = bezIn
            in_speed = 1
            out_bezier = bezOut
            out_speed = 3
        }
    }
pyt0xic commented 6 months ago

@obmutescences

Can you try add the following to your hyprland config

debug {
    disable_logs=0
    enable_stdout_logs=1
}

Then enable hyprfocus, restart hyprland and share your hyprland logs.

You can get the current log with

cat /tmp/hypr/$(ls -t /tmp/hypr/ | grep -v lock | head -n 1)/hyprland.log

You should see lines with [hyprfocus].

obmutescences commented 6 months ago

@obmutescences

Can you try add the following to your hyprland config

debug {
    disable_logs=0
    enable_stdout_logs=1
}

Then enable hyprfocus, restart hyprland and share your hyprland logs.

You can get the current log with

cat /tmp/hypr/$(ls -t /tmp/hypr/ | grep -v lock | head -n 1)/hyprland.log

You should see lines with [hyprfocus].

I will check tomorrow

pyt0xic commented 6 months ago

@obmutescences

There was a bug that prevented hyprfocus from reloading its config when it is updated, so you needed to restart hyprland for the plugin to start working after enabling it.

I just pushed a fix for this.

Hopefully it works for you now :)

daxisunder commented 6 months ago

I can't clone git@github.com:hyprwm/hyprland.git, I don't have access rights.

Try use the https url:

git clone https://github.com/hyprwm/hyprland.git --recursive

That's what I'm doing the whole time, but hyprpm won't build it (see the screenshots in my previous comment) and manually it does build, but it's crashing Hyprland as soon as I try to load it with hyprctl or when I add the plugin config to my Hyprland config, whichever I try first. Man, this really bugs me, I really liked this one. Oh, I forgot, you need the path to hyprfocus.so file in the Hyprland config, right?

ftelnov commented 6 months ago

@pyt0xic Firstly, thank you for bringing a second life for this plugin!! Could you please assist me with installing it? I have almost latest hyprland, installed from hyprland-git( 0.36.0.r45.12da0fc8-1). But when I compile your version, it throws errors:

src/Shrink.hpp: At global scope:
src/Shrink.hpp:9:3: error: invalid use of template-name ‘CAnimatedVariable’ without an argument list
    9 |   CAnimatedVariable m_sShrinkAnimation;
      |   ^~~~~~~~~~~~~~~~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:48:51: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘goalv’; did you mean ‘goal’?
   48 |     const auto GOALPOS = pWindow->m_vRealPosition.goalv();
      |                                                   ^~~~~
      |                                                   goal
src/Shrink.cpp:49:48: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘goalv’; did you mean ‘goal’?
   49 |     const auto GOALSIZE = pWindow->m_vRealSize.goalv();
      |                                                ^~~~~
      |                                                goal
src/Shrink.cpp:51:49: error: missing template arguments before ‘*’ token
   51 |     const auto *PANIMATION = (CAnimatedVariable *)pShrinkAnimation;
      |                                                 ^
src/Shrink.cpp:51:50: error: expected primary-expression before ‘)’ token
   51 |     const auto *PANIMATION = (CAnimatedVariable *)pShrinkAnimation;
      |                                                  ^
src/Shrink.cpp:55:60: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘vec’
   55 |                                       pWindow->m_vRealSize.vec() / 2.f);
      |                                                            ^~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:59:25: error: missing template arguments before ‘*’ token
   59 |     ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks();
      |                         ^
src/Shrink.cpp:59:26: error: expected primary-expression before ‘)’ token
   59 |     ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks();
      |                          ^
src/Shrink.cpp:59:27: error: expected ‘)’ before ‘pShrinkAnimation’
   59 |     ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks();
      |     ~                     ^~~~~~~~~~~~~~~~
      |                           )
make: *** [Makefile:4: all] Error 1

Command on which it failed: g++ -O2 -shared -fPIC --no-gnu-unique src/Flash.cpp src/IFocusAnimation.cpp src/main.cpp src/Shrink.cpp -o hyprfocus.sopkg-config --cflags pixman-1 libdrm hyprland-std=c++2b.

Thanks in advance for any help!!

obmutescences commented 6 months ago

@obmutescences

There was a bug that prevented hyprfocus from reloading its config when it is updated, so you needed to restart hyprland for the plugin to start working after enabling it.

I just pushed a fix for this.

Hopefully it works for you now :)

restart hyprland its working. thanks

daxisunder commented 6 months ago

@obmutescences There was a bug that prevented hyprfocus from reloading its config when it is updated, so you needed to restart hyprland for the plugin to start working after enabling it. I just pushed a fix for this. Hopefully it works for you now :)

restart hyprland its working. thanks

I just don't get it, it works for some, and for others it doesn't. I get the same error as you, but rebooting doesn't help.

pyt0xic commented 6 months ago

@obmutescences There was a bug that prevented hyprfocus from reloading its config when it is updated, so you needed to restart hyprland for the plugin to start working after enabling it. I just pushed a fix for this. Hopefully it works for you now :)

restart hyprland its working. thanks

I just don't get it, it works for some, and for others it doesn't. I get the same error as you, but rebooting doesn't help.

I am very confused as well...

Could you maybe try enabling debug logging in Hyprland and share the hyprland log file and crash report?

Actually could you share your hyprfocus config and the output of the following commands too:

hyprctl version
hyprpm update -v
hyprpm remove https://github.com/pyt0xic/hyprfocus # if still installed
hyprpm update -v # After removing the plugin
hyprpm add https://github.com/pyt0xic/hyprfocus -v
hyprpm enable hyprfocus -v
pyt0xic commented 6 months ago

@pyt0xic Firstly, thank you for bringing a second life for this plugin!! Could you please assist me with installing it? I have almost latest hyprland, installed from hyprland-git( 0.36.0.r45.12da0fc8-1). But when I compile your version, it throws errors:

src/Shrink.hpp: At global scope:
src/Shrink.hpp:9:3: error: invalid use of template-name ‘CAnimatedVariable’ without an argument list
    9 |   CAnimatedVariable m_sShrinkAnimation;
      |   ^~~~~~~~~~~~~~~~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:48:51: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘goalv’; did you mean ‘goal’?
   48 |     const auto GOALPOS = pWindow->m_vRealPosition.goalv();
      |                                                   ^~~~~
      |                                                   goal
src/Shrink.cpp:49:48: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘goalv’; did you mean ‘goal’?
   49 |     const auto GOALSIZE = pWindow->m_vRealSize.goalv();
      |                                                ^~~~~
      |                                                goal
src/Shrink.cpp:51:49: error: missing template arguments before ‘*’ token
   51 |     const auto *PANIMATION = (CAnimatedVariable *)pShrinkAnimation;
      |                                                 ^
src/Shrink.cpp:51:50: error: expected primary-expression before ‘)’ token
   51 |     const auto *PANIMATION = (CAnimatedVariable *)pShrinkAnimation;
      |                                                  ^
src/Shrink.cpp:55:60: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘vec’
   55 |                                       pWindow->m_vRealSize.vec() / 2.f);
      |                                                            ^~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:59:25: error: missing template arguments before ‘*’ token
   59 |     ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks();
      |                         ^
src/Shrink.cpp:59:26: error: expected primary-expression before ‘)’ token
   59 |     ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks();
      |                          ^
src/Shrink.cpp:59:27: error: expected ‘)’ before ‘pShrinkAnimation’
   59 |     ((CAnimatedVariable *)pShrinkAnimation)->resetAllCallbacks();
      |     ~                     ^~~~~~~~~~~~~~~~
      |                           )
make: *** [Makefile:4: all] Error 1

Command on which it failed: g++ -O2 -shared -fPIC --no-gnu-unique src/Flash.cpp src/IFocusAnimation.cpp src/main.cpp src/Shrink.cpp -o hyprfocus.sopkg-config --cflags pixman-1 libdrm hyprland-std=c++2b.

Thanks in advance for any help!!

That version of Hyprland has some breaking changes, I will update hyprfocus and pin the current and updated versions to their corresponding, working Hyprland commits.

Will probably only get to it tomorrow, you can downgrade to v0.36.0 (commit 1c460e98f870676b15871fe4e5bfeb1a32a3d6d8) if you would like to get hyprfocus working until I've made the changes.

daxisunder commented 6 months ago

hyprctl version swappy-20240307-041211 hyprpm update -v swappy-20240307-041354 hyprpm remove https://github.com/pyt0xic/hyprfocus swappy-20240307-041628 hyprpm update -v # After removing the plugin swappy-20240307-041800 hyprpm add https://github.com/pyt0xic/hyprfocus swappy-20240307-042136 swappy-20240307-042200 hyprpm enable hyprfocus swappy-20240307-042340 My plugin config is the copy of yours, but in the original instructions it says that I need the full path to hyprfocus.so so I tried plugin = /hom/daxis/hyprfocus/hyprfocus.so(with manually built plugin) and your config snippet below, that crashes Hyprland as soon as I save. I tried copying the manually built plugin to /home/daxis/.local/share/hyprpm/hyprfocus and passing that path, it doesn't crash but Hyprland shows an error (red banner on the top of the window). I tried just your config snippet without the path, it does nothing, like it's not there.

pyt0xic commented 6 months ago

hyprctl version swappy-20240307-041211 hyprpm update -v swappy-20240307-041354 hyprpm remove https://github.com/pyt0xic/hyprfocus swappy-20240307-041628 hyprpm update -v # After removing the plugin swappy-20240307-041800 hyprpm add https://github.com/pyt0xic/hyprfocus swappy-20240307-042136 swappy-20240307-042200 hyprpm enable hyprfocus swappy-20240307-042340 My plugin config is the copy of yours, but in the original instructions it says that I need the full path to hyprfocus.so so I tried plugin = /hom/daxis/hyprfocus/hyprfocus.so(with manually built plugin) and your config snippet below, that crashes Hyprland as soon as I save. I tried copying the manually built plugin to /home/daxis/.local/share/hyprpm/hyprfocus and passing that path, it doesn't crash but Hyprland shows an error (red banner on the top of the window). I tried just your config snippet without the path, it does nothing, like it's not there.

You need to downgrade Hyprland to v0.36.0/commit 1c460e98f870676b15871fe4e5bfeb1a32a3d6d8, if you need/want to use the latest git version, you will have to a wait for me to properly test and pin the new version of the plugin. Apologies :(

Regarding loading the plugin, everything is handled by hyprpm now. So you don't need to load them in your hyprland config or using hyprctl (although it probably won't do anything bad if you do xD). Once the plugin is installed and enabled with hyprpm, you just need to add exec-once=hyprpm reload -n to your Hyprland config so the enabled plugins are loaded at start (and passing -n means it will notify you if any plugins failed to load).

daxisunder commented 6 months ago

@pyt0xic I'll consider downgrading, but I think I'll wait for you to finish testing for the latest version. Thank you for maintaining this plugin.

chriselrod commented 6 months ago

@pyt0xic's fork worked for me:

> hyprpm remove hyprfocus
! removing a plugin repository: hyprfocus
  Are you sure? [Y/n] 
> hyprpm add https://github.com/pyt0xic/hyprfocus
✔ adding a new plugin repository from https://github.com/pyt0xic/hyprfocus
  MAKE SURE that you trust the authors. DO NOT install random plugins without verifying the code and author.
  Are you sure? [Y/n] 

! old plugin repo build files found in temp directory, removing.                                                        
 → Cloning https://github.com/pyt0xic/hyprfocus                                                                         
✔ cloned                                                                                                                
✔ found hyprpm manifest                                                                                                 
✔ parsed manifest, found 1 plugins:                                                                                     
 → hyprfocus by VortexCoyote, OakleyCord, vaxerski, DRAGONTOS, pyt0xic version                                          
✔ Hyprland headers OK                                                                                                   
 → Building hyprfocus                                                                                                   
✔ built hyprfocus into hyprfocus.so                                                                                     
✔ all plugins built                                                                                                     
✔ installed repository                                                                                                  
✔ you can now enable the plugin(s) with hyprpm enable                                                                   
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  5 / 5  Done!                                                       
> hyprpm enable hyprfocus
✔ Enabled hyprfocus
✔ Ensuring plugin load state
✔ Loaded hyprfocus
✔ Plugin load state ensured

I used to have a shrinking effect, while now I get a temporary opacity drop. I don't mind, I just want to know which tile I am on (I don't have any status bars, so it's nice to have some visual effect to quickly find where I am in case I forget).

FWIW, I'm on Fedora 39, which just updated to the latest hyprland release.

pyt0xic commented 6 months ago

@pyt0xic's fork worked for me:

> hyprpm remove hyprfocus
! removing a plugin repository: hyprfocus
  Are you sure? [Y/n] 
> hyprpm add https://github.com/pyt0xic/hyprfocus
✔ adding a new plugin repository from https://github.com/pyt0xic/hyprfocus
  MAKE SURE that you trust the authors. DO NOT install random plugins without verifying the code and author.
  Are you sure? [Y/n] 

! old plugin repo build files found in temp directory, removing.                                                        
 → Cloning https://github.com/pyt0xic/hyprfocus                                                                         
✔ cloned                                                                                                                
✔ found hyprpm manifest                                                                                                 
✔ parsed manifest, found 1 plugins:                                                                                     
 → hyprfocus by VortexCoyote, OakleyCord, vaxerski, DRAGONTOS, pyt0xic version                                          
✔ Hyprland headers OK                                                                                                   
 → Building hyprfocus                                                                                                   
✔ built hyprfocus into hyprfocus.so                                                                                     
✔ all plugins built                                                                                                     
✔ installed repository                                                                                                  
✔ you can now enable the plugin(s) with hyprpm enable                                                                   
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  5 / 5  Done!                                                       
> hyprpm enable hyprfocus
✔ Enabled hyprfocus
✔ Ensuring plugin load state
✔ Loaded hyprfocus
✔ Plugin load state ensured

I used to have a shrinking effect, while now I get a temporary opacity drop. I don't mind, I just want to know which tile I am on (I don't have any status bars, so it's nice to have some visual effect to quickly find where I am in case I forget).

FWIW, I'm on Fedora 39, which just updated to the latest hyprland release.

Thanks for the feedback!

Does the window not shrink at all? Or does it shrink and flash? Could you share your plugin config please.

Side note,I'm curious why Fedora is your distro of choice, I've never used it😅

pyt0xic commented 6 months ago

@pyt0xic I'll consider downgrading, but I think I'll wait for you to finish testing for the latest version. Thank you for maintaining this plugin.

I'll try get everything pushed tomorrow, Ive been distracted by another plugin I'm working on sorry 😂

chriselrod commented 6 months ago

Does the window not shrink at all? Or does it shrink and flash?

Flashes only.

Could you share your plugin config please.

plugin:hyprfocus {
    enabled = yes

    keyboard_focus_animation = shrink
    mouse_focus_animation = flash

    bezier = bezIn, 0.5,0.0,1.0,0.5
    bezier = bezOut, 0.0,0.5,0.5,1.0

    flash {
        flash_opacity = 0.7

        in_bezier = bezIn
        in_speed = 0.5

        out_bezier = bezOut
        out_speed = 3
    }

    shrink {
        shrink_percentage = 0.8

        in_bezier = bezIn
        in_speed = 0.5

        out_bezier = bezOut
        out_speed = 3
    }
}

I'm not sure why I have different mouse vs keyboard animation settings. Before, it always shrunk (whether mouse or keyboard) and now it always flashes (whether mouse or keyboard).

Side note,I'm curious why Fedora is your distro of choice, I've never used it😅

FWIW, I think choices like window manager are way more important than distro. I spend way more time interacting with the WM than I ever do installing packages.

I mostly use Fedora because it is the most up to date distro w/ respect to compiler versions, and I'd prefer to avoid managing the toolchains myself if I can avoid it. Arch is like 6 months behind Fedora with clang, for example.

I'll start using "deducing this" on my personal projects as soon as Fedora has both gcc 14 and clang 18, which will probably be later this month when I switch to Fedora 40 beta. "Deducing this" is not supported on gcc 13 or clang 17. With Arch, I'd have to build the latest compiler toolchains from source and set paths. Not that big a deal, but...

daxisunder commented 6 months ago

@chriselrod

I'm not sure why I have different mouse vs keyboard animation settings.

You don't need both, only focus_animation= and you set whichever you want.

pyt0xic commented 6 months ago

@daxisunder

I'm going to add support for hyprland-git now.

I'm also thinking I should separate the mouse and keyboard focus animation configs again.

I didn't realize that some people might actually want to use a different animation for each 😂

There's a couple new features I want to add, mostly adding the option to disable the focus animation for fullscreen windows and when switching workspaces.

Hopefully https://github.com/hyprwm/Hyprland/pull/1318 gets merged soon so I can add a wobble animation🙏

daxisunder commented 6 months ago

I'm going to add support for hyprland-git now.

Did you add it? It still throws the same error.

ndom91 commented 6 months ago

Just wanted to +1 the separate mouse/keyboard animation options :blush:

And point out that pyt0xic/hyprfocus seems to fail to compile with the latest hyprland version (37.1). I've got the flake setup like this:

hyprland.url = "github:hyprwm/hyprland?ref=v0.37.1";
hyprfocus = {
  url = "github:pyt0xic/hyprfocus";
  inputs.hyprland.follows = "hyprland";
};

Error:

building the system configuration...
error: builder for '/nix/store/s7rmf5fqs5xsr5j3808a4jbr0l2jji4b-hyprfocus-0.1.drv' failed with exit code 2;
       last 10 log lines:
       >       |                           )
       > In file included from src/main.cpp:13:
       > src/Shrink.hpp:9:3: error: invalid use of template-name 'CAnimatedVariable' without an argument list
       >     9 |   CAnimatedVariable m_sShrinkAnimation;
       >       |   ^~~~~~~~~~~~~~~~~
       > src/main.cpp: In function 'void onMouseButton(void*, std::any)':
       > src/main.cpp:94:54: warning: comparison between 'enum wl_pointer_button_state' and 'enum wlr_button_state' [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wenum-compare-Wenum-compare8;;]
       >    94 |     g_bMouseWasPressed = PWLRMOUSEBUTTONEVENT->state == WLR_BUTTON_PRESSED;
       >       |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
       > make: *** [Makefile:4: all] Error 1
       For full logs, run 'nix log /nix/store/s7rmf5fqs5xsr5j3808a4jbr0l2jji4b-hyprfocus-0.1.drv'.
error: 1 dependencies of derivation '/nix/store/1vnk3dshbak9xsydc8j1g5hid6rqjm5z-hm_hyprhyprland.conf.drv' failed to build
error: 1 dependencies of derivation '/nix/store/vk8m784vz9k95j7xjbpc3z9r002wadl4-activation-script.drv' failed to build
error: 1 dependencies of derivation '/nix/store/brc1psb6yf2r9gnln1k554f6qbdmh839-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/x7abg3m0qpdmy5i1gqanbv3hb7c2b83h-unit-home-manager-ndo.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/71frqfby3x6nazlaqjp6w9dn5jbnflv3-system-units.drv' failed to build
error: 1 dependencies of derivation '/nix/store/c0mnqg5drxdigfizspn4qz2y82551yg9-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/p4sxp9lbd6qb3xr5si898km12v5pdnki-nixos-system-ndo4-23.11.20240226.b7ee09c.drv' failed to build
pyt0xic commented 5 months ago

@daxisunder @ndom91

Apologies for the delay, been on Holiday.

I've updated the plugin to support v0.37.1, I also setup commit pinning for v0.36.0 and v0.37.1.

It should also work with v0.37.0 and the master branch.

Let me know if you have any issues.

ndom91 commented 5 months ago

No worries, works like a charm!

I'm using the Hyprland flake from main, currently on 30c5911

daxisunder commented 5 months ago

Sorry man, but it still doesn't work for me. On v0.37.1-34-g4c796683 swappy-20240321-152146 swappy-20240321-152224 swappy-20240321-152307 swappy-20240321-152335

pyt0xic commented 5 months ago

Sorry man, but it still doesn't work for me. On v0.37.1-34-g4c796683 swappy-20240321-152146 swappy-20240321-152224 swappy-20240321-152307 swappy-20240321-152335

It looks like the error is in the Hyprland headers, hyprpm keeps it's own copy of them, have you run hyprpm update -v since updating Hyprland?

daxisunder commented 5 months ago

I have, I run it every time before trying to add a repo. Also, official plugins work fine. I'm also using hyprlang-git and wlroots-git if that has anything to do with this. swappy-20240321-172133

ndom91 commented 5 months ago

I have, I run it every time before trying to add a repo. Also, official plugins work fine. I'm also using hyprlang-git and wlroots-git if that has anything to do with this. swappy-20240321-172133

Is your hyprfocus flake following Hyprland? Did you update the flake? nix flake lock update hyprfocus or something like that, don't remember off the top of my head

hyprfocus = { 
 url = "github:pyt0xic/hyprfocus";
 inputs.hyprland.follows = "hyprland"; 
};
daxisunder commented 5 months ago

Is your hyprfocus flake following Hyprland? Did you update the flake? nix flake lock update hyprfocus or something like that, don't remember off the top of my head

hyprfocus = { 
 url = "github:pyt0xic/hyprfocus";
 inputs.hyprland.follows = "hyprland"; 
};

I'm not on Nix, I'm on Arch.

pyt0xic commented 5 months ago

I have, I run it every time before trying to add a repo. Also, official plugins work fine. I'm also using hyprlang-git and wlroots-git if that has anything to do with this. swappy-20240321-172133

Damn you really are not having any luck with this xD.

I'm struggling to replicate the error, if possible could you please share the following:

daxisunder commented 5 months ago

Yes! It finally works. I downgraded hyprland, hyprlang and wlroots to non-git versions, it built fine and it works as expected. Thank you for all the help and for maintaining this plugin, it's my favorite.

pyt0xic commented 5 months ago

Yes! It finally works. I downgraded hyprland, hyprlang and wlroots to non-git versions, it built fine and it works as expected. Thank you for all the help and for maintaining this plugin, it's my favorite.

That is awesome!!!!!

I suspect wlroots-git was the culprit...

I believe Hyprland installs the wlroots headers during make installheaders and by adding wlroots-git you had wlroots header files that were incompatible/ahead of the version used by Hyprland...

I am not 100% sure, but that is my best guess...