Code Monkey home page Code Monkey logo

hyprfocus's Introduction

hyprfocus

a plugin which provides focus animations for us borderless folks, originally inspired by flashfocus!

i'm on a tight schedule, so pull requests are welcome!

animations

flash

preview

shrink

preview

compilation & installation

instructions based on the official wiki

hyprpm

1) add hyprfocus

hyprpm add https://github.com/VortexCoyote/hyprfocus

2) verify that it's installed

hyprpm list

3) enable it and reload

hyprpm enable hyprfocus && hyprpm reload

4) (OPTIONAL) make sure plugins are loaded at startup

this goes into you hyprland config: exec-once = hyprpm reload -n

manual

1) clone hyprfocus and cd into it

git clone https://github.com/VortexCoyote/hyprfocus && cd hyprfocus

2) clone hyprland and cd into it

git clone --recursive https://github.com/hyprwm/Hyprland && cd Hyprland

3) checkout the correct release tag matching with your version of hyprland

git checkout tags/v0.26.0

4) prepare the hyprland source for plugin compilation

make all && sudo make installheaders

5) cd back and make

cd .. && make all

6) profit, make sure you use the full path to the .so file

hyprctl plugin load <full .so path>

If you compile hyprland manually and install with sudo make install you can skip the cloning hyprland sources and make pluginenv part.

getting started

to start using hyprfocus, add this to your hyprland config:

plugin = <full .so path>

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

plugin configuration

enabled (yes/no) -> enable or disable the plugin

keyboard_focus_animation (flash/shrink/nothing) -> animation for keyboard-driven focus

mouse_focus_animation (flash/shrink/nothing) -> animation for mouse pressed focus (setting input:follow_mouse = 0, input:float_switch_override_focus = 0 and input:mouse_refocus = false is recommended)

animations configuration

animations can be configured within the plugin scope with the following syntax:

plugin:hyprfocus {
    <animation> {

    }
}

shared animation variables

in_bezier (bezier) -> bezier curve towards the animation apex

out_bezier (bezier) -> bezier curve towards the default window state

in_speed (float) -> speed for the 'in' bezier

out_speed (float) -> speed for the 'out' bezier

flash

flash_opacity (float) -> opacity to during the flash's apex

shrink

shrink_percentage (float) -> the amount a window has shrunk during the animation's apex

dispatching

hyprfocus can also flash the currently focused window through the animatefocused dispatcher:

bind = $mod, space, animatefocused

future plans

I'm mostly planning on implementing more animations, for example a popin-popout bounce animation. But if you have any suggestions, feel free to create a git issue!

hyprfocus's People

Contributors

oakleycord avatar vaxerski avatar vortexcoyote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hyprfocus's Issues

What's the right way to compile it?

If I just cloned this repo and run

make all

I get the error

g++ -shared -fPIC --no-gnu-unique main.cpp -o hyprfocus.so -g -I "/usr/include/pixman-1" -I "/usr/include/libdrm" -I "" -I "/subprojects/wlroots/include" -I "/subprojects/wlroots/include" -I "/subprojects/wlroots/build/include" -std=c++23
main.cpp:3:10: fatal error: src/plugins/PluginAPI.hpp: No such file or directory
    3 | #include <src/plugins/PluginAPI.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:6: all] Error 1

But if I do it like described here I get this instead

HYPRLAND_HEADERS="../Hyprland" make all 
g++ -shared -fPIC --no-gnu-unique main.cpp -o hyprfocus.so -g -I "/usr/include/pixman-1" -I "/usr/include/libdrm" -I "../Hyprland" -I "../Hyprland/subprojects/wlroots/include" -I "../Hyprland/subprojects/wlroots/include" -I "../Hyprland/subprojects/wlroots/build/include" -std=c++23
In file included from ../Hyprland/src/defines.hpp:1,
                 from ../Hyprland/src/Window.hpp:3,
                 from main.cpp:7:
../Hyprland/src/includes.hpp:74:10: fatal error: wlr/types/wlr_output_damage.h: No such file or directory
   74 | #include <wlr/types/wlr_output_damage.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:6: all] Error 1

Build Issues on Hyperland 0.37.1-1

Hi,

Having build issues on Hyperland 0.37.1-1 (Arch) after updating.

See below for hyprpm log:

[v] version returned: Hyprland, built from branch HEAD at commit c5e28ebcfe00a510922779b2c568cfa52a317445  (props: bump ver 0.37.1).
Date: Sat Mar 16 14:51:49 2024
Tag: v0.37.1

flags: (if any)


[v] parsed commit c5e28ebcfe00a510922779b2c568cfa52a317445 at branch HEAD
✔ adding a new plugin repository from https://github.com/VortexCoyote/hyprfocus
  MAKE SURE that you trust the authors. DO NOT install random plugins without verifying the code and author.
  Are you sure? [Y/n]

 → Cloning https://github.com/VortexCoyote/hyprfocus
✔ cloned
✔ found hyprload manifest
✔ parsed manifest, found 1 plugins:
 → hyprfocus by Vortex version 2.0
✔ Hyprland headers OK
 → Building hyprfocus
✖ Plugin hyprfocus failed to build.

 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╍━━━━━━━━━━━━━━━━━━━  3 / 5  Building plugin(s)[v] shell returned:  -> cd /tmp/hyprpm/new && PKG_CONFIG_PATH="/home/aviherman/.local/share/hyprpm/headersRoot/share/pkgconfig" make all
g++ -shared -fPIC --no-gnu-unique src/Flash.cpp src/IFocusAnimation.cpp src/main.cpp src/Shrink.cpp src/Flash.hpp src/IFocusAnimation.hpp src/Shrink.hpp  -o hyprfocus.so -g `pkg-config --cflags pixman-1 libdrm hyprland` -std=c++2b
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from src/IFocusAnimation.hpp:5,
                 from src/Flash.hpp:3,
                 from src/Flash.cpp:1:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
src/IFocusAnimation.hpp: At global scope:
src/IFocusAnimation.hpp:12:70: error: ‘SConfigValue’ has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: ‘SConfigValue’ does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Flash.cpp: In member function ‘virtual void CFlash::init(void*, std::string)’:
src/Flash.cpp:10:77: error: C99 designator ‘floatValue’ outside aggregate initializer
   10 |     addConfigValue(pHandle, "flash_opacity", SConfigValue{.floatValue = 0.5f});
      |                                                                             ^
src/Flash.cpp:10:77: error: invalid use of incomplete type ‘struct SConfigValue’
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/../managers/HookSystemManager.hpp:12,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/Screencopy.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/ToplevelExport.hpp:6,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/ProtocolManager.hpp:4,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/Compositor.hpp:18,
                 from src/Flash.cpp:3:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/../managers/../plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/Flash.cpp: In member function ‘virtual void CFlash::onWindowFocus(CWindow*, void*)’:
src/Flash.cpp:16:25: error: ‘getConfigValue’ was not declared in this scope; did you mean ‘HyprlandAPI::getConfigValue’?
   16 |     pWindow->m_fAlpha = getConfigValue(pHandle, "flash_opacity")->floatValue;
      |                         ^~~~~~~~~~~~~~
      |                         HyprlandAPI::getConfigValue
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/../managers/../plugins/PluginAPI.hpp:133:37: note: ‘HyprlandAPI::getConfigValue’ declared here
  133 |     APICALL Hyprlang::CConfigValue* getConfigValue(HANDLE handle, const std::string& name);
      |                                     ^~~~~~~~~~~~~~
src/Flash.cpp: In lambda function:
src/Flash.cpp:20:100: error: ‘class Hyprlang::CConfigValue’ has no member named ‘floatValue’; did you mean ‘getValue’?
   20 |             pWindow->m_fAlpha = HyprlandAPI::getConfigValue(pHandle, "decoration:active_opacity")->floatValue;
      |                                                                                                    ^~~~~~~~~~
      |                                                                                                    getValue
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from src/IFocusAnimation.hpp:5,
                 from src/IFocusAnimation.cpp:1:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
src/IFocusAnimation.hpp: At global scope:
src/IFocusAnimation.hpp:12:70: error: ‘SConfigValue’ has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: ‘SConfigValue’ does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/IFocusAnimation.cpp: In member function ‘virtual void IFocusAnimation::init(void*, std::string)’:
src/IFocusAnimation.cpp:8:107: error: C99 designator ‘strValue’ outside aggregate initializer
    8 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "in_bezier",  SConfigValue{.strValue = "default"});
      |                                                                                                           ^
src/IFocusAnimation.cpp:8:107: error: invalid use of incomplete type ‘struct SConfigValue’
In file included from src/IFocusAnimation.cpp:3:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp:9:107: error: C99 designator ‘strValue’ outside aggregate initializer
    9 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "out_bezier", SConfigValue{.strValue = "default"});
      |                                                                                                           ^
src/IFocusAnimation.cpp:9:107: error: invalid use of incomplete type ‘struct SConfigValue’
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp:11:102: error: C99 designator ‘floatValue’ outside aggregate initializer
   11 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "in_speed",  SConfigValue{.floatValue = 1.f});
      |                                                                                                      ^
src/IFocusAnimation.cpp:11:102: error: invalid use of incomplete type ‘struct SConfigValue’
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp:12:102: error: C99 designator ‘floatValue’ outside aggregate initializer
   12 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "out_speed", SConfigValue{.floatValue = 5.f});
      |                                                                                                      ^
src/IFocusAnimation.cpp:12:102: error: invalid use of incomplete type ‘struct SConfigValue’
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp: In member function ‘virtual void IFocusAnimation::onWindowFocus(CWindow*, void*)’:
src/IFocusAnimation.cpp:26:117: error: ‘class Hyprlang::CConfigValue’ has no member named ‘strValue’
   26 |     m_sFocusInAnimConfig.internalBezier       = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "in_bezier")->strValue;
      |                                                                                                                     ^~~~~~~~
src/IFocusAnimation.cpp:27:116: error: ‘class Hyprlang::CConfigValue’ has no member named ‘floatValue’; did you mean ‘getValue’?
   27 |     m_sFocusInAnimConfig.internalSpeed        = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "in_speed")->floatValue;
      |                                                                                                                    ^~~~~~~~~~
      |                                                                                                                    getValue
src/IFocusAnimation.cpp:29:118: error: ‘class Hyprlang::CConfigValue’ has no member named ‘strValue’
   29 |     m_sFocusOutAnimConfig.internalBezier      = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "out_bezier")->strValue;
      |                                                                                                                      ^~~~~~~~
src/IFocusAnimation.cpp:30:117: error: ‘class Hyprlang::CConfigValue’ has no member named ‘floatValue’; did you mean ‘getValue’?
   30 |     m_sFocusOutAnimConfig.internalSpeed       = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "out_speed")->floatValue;
      |                                                                                                                     ^~~~~~~~~~
      |                                                                                                                     getValue
src/IFocusAnimation.cpp: At global scope:
src/IFocusAnimation.cpp:33:6: error: no declaration matches ‘void IFocusAnimation::addConfigValue(void*, std::string, SConfigValue)’
   33 | void IFocusAnimation::addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue) {
      |      ^~~~~~~~~~~~~~~
src/IFocusAnimation.hpp:12:21: note: candidate is: ‘void IFocusAnimation::addConfigValue(void*, std::string, int)’
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                     ^~~~~~~~~~~~~~
src/IFocusAnimation.hpp:7:7: note: ‘class IFocusAnimation’ defined here
    7 | class IFocusAnimation {
      |       ^~~~~~~~~~~~~~~
src/IFocusAnimation.cpp:37:15: error: no declaration matches ‘SConfigValue* IFocusAnimation::getConfigValue(void*, std::string)’
   37 | SConfigValue* IFocusAnimation::getConfigValue(HANDLE pHandle, std::string name) {
      |               ^~~~~~~~~~~~~~~
src/IFocusAnimation.cpp:37:15: note: no functions named ‘SConfigValue* IFocusAnimation::getConfigValue(void*, std::string)’
src/IFocusAnimation.hpp:7:7: note: ‘class IFocusAnimation’ defined here
    7 | class IFocusAnimation {
      |       ^~~~~~~~~~~~~~~
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/Compositor.hpp:10,
                 from src/main.cpp:7:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
In file included from src/main.cpp:12:
src/Shrink.hpp: At global scope:
src/Shrink.hpp:10:5: error: invalid use of template-name ‘CAnimatedVariable’ without an argument list
   10 |     CAnimatedVariable m_sShrinkAnimation;
      |     ^~~~~~~~~~~~~~~~~
src/main.cpp: In function ‘void flashWindow(CWindow*)’:
src/main.cpp:22:128: error: ‘class Hyprlang::CConfigValue’ has no member named ‘strValue’
   22 |     auto* const PTYPE = g_bMouseWasPressed  ? &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:mouse_focus_animation")->strValue
      |                                                                                                                                ^~~~~~~~
src/main.cpp:23:131: error: ‘class Hyprlang::CConfigValue’ has no member named ‘strValue’
   23 |                                             : &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:keyboard_focus_animation")->strValue;
      |                                                                                                                                   ^~~~~~~~
src/main.cpp: In function ‘void flashCurrentWindow(std::string)’:
src/main.cpp:29:111: error: ‘class Hyprlang::CConfigValue’ has no member named ‘intValue’; did you mean ‘getValue’?
   29 |     static auto* const PHYPRFOCUSENABLED = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:enabled")->intValue;
      |                                                                                                               ^~~~~~~~
      |                                                                                                               getValue
src/main.cpp: In function ‘void onActiveWindowChange(void*, std::any)’:
src/main.cpp:43:115: error: ‘class Hyprlang::CConfigValue’ has no member named ‘intValue’; did you mean ‘getValue’?
   43 |         static auto* const PHYPRFOCUSENABLED = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:enabled")->intValue;
      |                                                                                                                   ^~~~~~~~
      |                                                                                                                   getValue
src/main.cpp: In function ‘void onMouseButton(void*, std::any)’:
src/main.cpp:63:58: warning: comparison between ‘enum wl_pointer_button_state’ and ‘enum wlr_button_state’ [-Wenum-compare]
   63 |         g_bMouseWasPressed = PWLRMOUSEBUTTONEVENT->state == WLR_BUTTON_PRESSED;
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
src/main.cpp: In function ‘PLUGIN_DESCRIPTION_INFO pluginInit(void*)’:
src/main.cpp:76:121: error: C99 designator ‘intValue’ outside aggregate initializer
   76 |     HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:enabled",                    SConfigValue{.intValue = 0      });
      |                                                                                                                         ^
src/main.cpp:76:121: error: invalid use of incomplete type ‘struct SConfigValue’
In file included from src/main.cpp:3:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/main.cpp:77:121: error: C99 designator ‘strValue’ outside aggregate initializer
   77 |     HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:keyboard_focus_animation",   SConfigValue{.strValue = "flash"});
      |                                                                                                                         ^
src/main.cpp:77:121: error: invalid use of incomplete type ‘struct SConfigValue’
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/main.cpp:78:121: error: C99 designator ‘strValue’ outside aggregate initializer
   78 |     HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:mouse_focus_animation",      SConfigValue{.strValue = "flash"});
      |                                                                                                                         ^
src/main.cpp:78:121: error: invalid use of incomplete type ‘struct SConfigValue’
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from src/IFocusAnimation.hpp:5,
                 from src/Shrink.hpp:3,
                 from src/Shrink.cpp:1:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
src/IFocusAnimation.hpp: At global scope:
src/IFocusAnimation.hpp:12:70: error: ‘SConfigValue’ has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: ‘SConfigValue’ does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Shrink.hpp:10:5: error: invalid use of template-name ‘CAnimatedVariable’ without an argument list
   10 |     CAnimatedVariable m_sShrinkAnimation;
      |     ^~~~~~~~~~~~~~~~~
src/Shrink.cpp: In member function ‘virtual void CShrink::init(void*, std::string)’:
src/Shrink.cpp:10:81: error: C99 designator ‘floatValue’ outside aggregate initializer
   10 |     addConfigValue(pHandle, "shrink_percentage", SConfigValue{.floatValue = 0.5f});
      |                                                                                 ^
src/Shrink.cpp:10:81: error: invalid use of incomplete type ‘struct SConfigValue’
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/../managers/HookSystemManager.hpp:12,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/Screencopy.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/ToplevelExport.hpp:6,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/ProtocolManager.hpp:4,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/Compositor.hpp:18,
                 from src/Shrink.cpp:3:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/../managers/../plugins/PluginAPI.hpp:63:8: note: forward declaration of ‘struct SConfigValue’
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/Shrink.cpp: In member function ‘virtual void CShrink::onWindowFocus(CWindow*, void*)’:
src/Shrink.cpp:20:35: error: ‘getConfigValue’ was not declared in this scope; did you mean ‘HyprlandAPI::getConfigValue’?
   20 |     const auto SHRINKPERCENTAGE = getConfigValue(pHandle, "shrink_percentage")->floatValue;
      |                                   ^~~~~~~~~~~~~~
      |                                   HyprlandAPI::getConfigValue
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/managers/../protocols/../managers/../plugins/PluginAPI.hpp:133:37: note: ‘HyprlandAPI::getConfigValue’ declared here
  133 |     APICALL Hyprlang::CConfigValue* getConfigValue(HANDLE handle, const std::string& name);
      |                                     ^~~~~~~~~~~~~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:30:68: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘goalv’; did you mean ‘goal’?
   30 |                 const auto GOALPOS      = pWindow->m_vRealPosition.goalv();
      |                                                                    ^~~~~
      |                                                                    goal
src/Shrink.cpp:31:64: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘goalv’; did you mean ‘goal’?
   31 |                 const auto GOALSIZE     = pWindow->m_vRealSize.goalv();
      |                                                                ^~~~~
      |                                                                goal
src/Shrink.cpp:33:61: error: missing template arguments before ‘*’ token
   33 |                 const auto* PANIMATION  = (CAnimatedVariable*)pShrinkAnimation;
      |                                                             ^
src/Shrink.cpp:33:62: error: expected primary-expression before ‘)’ token
   33 |                 const auto* PANIMATION  = (CAnimatedVariable*)pShrinkAnimation;
      |                                                              ^
src/Shrink.cpp:36:99: error: ‘class CAnimatedVariable<Vector2D>’ has no member named ‘vec’
   36 |                 pWindow->m_vRealPosition.setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize.vec() / 2.f);
      |                                                                                                   ^~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:40:36: error: missing template arguments before ‘*’ token
   40 |                 ((CAnimatedVariable*)pShrinkAnimation)->resetAllCallbacks();
      |                                    ^
src/Shrink.cpp:40:37: error: expected primary-expression before ‘)’ token
   40 |                 ((CAnimatedVariable*)pShrinkAnimation)->resetAllCallbacks();
      |                                     ^
src/Shrink.cpp:40:38: error: expected ‘)’ before ‘pShrinkAnimation’
   40 |                 ((CAnimatedVariable*)pShrinkAnimation)->resetAllCallbacks();
      |                 ~                    ^~~~~~~~~~~~~~~~
      |                                      )
src/Flash.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from src/IFocusAnimation.hpp:5,
                 from src/Flash.hpp:3:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
src/IFocusAnimation.hpp: At global scope:
src/IFocusAnimation.hpp:12:70: error: ‘SConfigValue’ has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: ‘SConfigValue’ does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/IFocusAnimation.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from src/IFocusAnimation.hpp:5:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
src/IFocusAnimation.hpp: At global scope:
src/IFocusAnimation.hpp:12:70: error: ‘SConfigValue’ has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: ‘SConfigValue’ does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Shrink.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
In file included from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../Window.hpp:8,
                 from /home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/ConfigManager.hpp:16,
                 from src/IFocusAnimation.hpp:5,
                 from src/Shrink.hpp:3:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp: In member function ‘virtual std::string CGradientValueData::toString()’:
/home/aviherman/.local/share/hyprpm/headersRoot/include/hyprland/src/config/../config/ConfigDataValues.hpp:64:5: warning: no return statement in function returning non-void [-Wreturn-type]
   64 |     }
      |     ^
src/IFocusAnimation.hpp: At global scope:
src/IFocusAnimation.hpp:12:70: error: ‘SConfigValue’ has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: ‘SConfigValue’ does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Shrink.hpp:10:5: error: invalid use of template-name ‘CAnimatedVariable’ without an argument list
   10 |     CAnimatedVariable m_sShrinkAnimation;
      |     ^~~~~~~~~~~~~~~~~
make: *** [Makefile:4: all] Error 1


✔ all plugins built
✔ installed repository
✔ you can now enable the plugin(s) with hyprpm enable
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  5 / 5  Done!

I recently was involved in fixing another plugin, split-monitor-workspaces, that suffered from a similar issue: Duckonaut/split-monitor-workspaces#56

Only animate on keybinding

Hi,

I would like to animate windows only via the binding animatefocused and not when switching focus. Would this be possible?

Given the following config, the animatefocused command does not animate the given window. In CLI it however returns OK.

Sample config:

bind = $mainMod, Backspace, animatefocused

plugin:hyprfocus {
    enabled = yes

    keyboard_focus_animation = nothing
    mouse_focus_animation = nothing
}

Thanks!

[Feature Request] Dim animation

I like the dim_inactive feature of Hyprland but keeping it on all the time makes it difficult to reference inactive windows. Would it be possible to temporarily dim inactive windows with hyprfocus?

Nix package error;

Hello, I'm making progress to compile this package inside hyprland as a nix flake.

A good guide has been https://github.com/hyprwm/hyprland-plugins?tab=readme-ov-file#nix - maybe that codebase can inspire some changes to this one's flake.nix.'

Here are changes I made to my NixOS flake:

diff --git a/nixos/flake.nix b/nixos/flake.nix
index 2c8f6c7..5ac8d4f 100644
--- a/nixos/flake.nix
+++ b/nixos/flake.nix
@@ -1,9 +1,18 @@
 { inputs = {
     home-manager.url = "github:nix-community/home-manager";
     nixos-hardware.url = "github:nixos/nixos-hardware";
     nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
     alacritty-theme.url = "github:alexghr/alacritty-theme.nix";
+
+    hyprland.url = "github:hyprwm/Hyprland";
+    hyprland-plugins = {
+      url = "github:hyprwm/hyprland-plugins";
+      inputs.hyprland.follows = "hyprland";
+    };
+    hyprfocus = {
+      url = "github:VortexCoyote/hyprfocus";
+      inputs.hyprland.follows = "hyprland";
+    };
   };
                                                                                                                
   # hook up symlinks!
diff --git a/nixos/module/hypr.nix b/nixos/module/hypr.nix
index 535677f..47fe547 100644
--- a/nixos/module/hypr.nix
+++ b/nixos/module/hypr.nix
@@ -1,4 +1,4 @@
-{ pkgs, home-manager, ... }:
+{ pkgs, home-manager, ... } @ inputs:
 {
   programs.hyprland = { enable = true; xwayland.enable = true; };
   services.xserver = { enable = true; displayManager = {
@@ -48,6 +48,8 @@
     wayland.windowManager.hyprland = {
       enable = true;
       systemd.enable = true;
+      package = inputs.hyprland.packages.${pkgs.system}.hyprland;
+      plugins = [ inputs.hyprfocus.packages.${pkgs.system}.hyprfocus ];
                                                                                                                
       settings = {
         "$fileManager" = "thunar";
@@ -60,6 +62,7 @@
         ];
                                                                                                                
         exec-once = [
+          "hyprpm reload -n"
           "nm-applet --indicator"
           "pypr"
           "swww init"

Erasing the plugins = [ ... ]; line means I can compile properly.

Enabling the plugins line means I see:

/home/calliope/.build> sudo nixos-rebuild switch                                                                                                                                                           1 03/14/24 14:12:41 PM
warning: Git tree '/home/calliope/.build' is dirty
warning: updating lock file '/home/calliope/.build/nixos/flake.lock':
• Added input 'hyprfocus':
    'github:VortexCoyote/hyprfocus/fa6775c0481f0d3628487cc26f7c7456fa082fb7' (2024-03-14)
• Added input 'hyprfocus/hyprland':
    follows 'hyprland'
• Added input 'hyprfocus/nix-filter':
    'github:numtide/nix-filter/41fd48e00c22b4ced525af521ead8792402de0ea' (2023-09-16)
warning: Git tree '/home/calliope/.build' is dirty
building the system configuration...
warning: Git tree '/home/calliope/.build' is dirty
error: builder for '/nix/store/bhrinv55bampcm8clsglfxz59w4w9sh4-hyprfocus-0.1.drv' failed with exit code 2;
       last 10 log lines:
       > src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
       >    12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
       >       |                                                                      ^~~~~~~~~~~~
       > src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
       >    13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
       >       |     ^~~~~~~~~~~~
       > src/Shrink.hpp:10:5: error: invalid use of template-name 'CAnimatedVariable' without an argument list
       >    10 |     CAnimatedVariable m_sShrinkAnimation;
       >       |     ^~~~~~~~~~~~~~~~~
       > make: *** [Makefile:4: all] Error 1
       For full logs, run 'nix log /nix/store/bhrinv55bampcm8clsglfxz59w4w9sh4-hyprfocus-0.1.drv'.
error: 1 dependencies of derivation '/nix/store/7r59wcwyxvchcdwviswmhyk90gk14x62-hm_hyprhyprland.conf.drv' failed to build
error: 1 dependencies of derivation '/nix/store/m9i9n1a88sair5ipgpmdhi8b16sjk9ll-activation-script.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2zz36c7nd3afibv0wpl1hsc2i0rcdbya-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fgd7gpv5b2dm3fl0hig5bz65snc2g08p-unit-home-manager-calliope.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wpiynpmg0hyibsqkaiy6sc49sspg701p-system-units.drv' failed to build
error: 1 dependencies of derivation '/nix/store/0rq7ad8r8bn82yj35055jw0qxwld6v1b-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ag5vvlmvj96lc1jlw7mmgksngcgb43iv-nixos-system-chesapeake-24.05.20240115.c3e128f.drv' failed to build
Full error log
@nix { "action": "setPhase", "phase": "unpackPhase" }
Running phase: unpackPhase
unpacking source archive /nix/store/nl7x5d1idwlrlhbwhbigrdvvyc0rpnni-source
source root is source
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
Running phase: configurePhase
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
Running phase: buildPhase
build flags: SHELL=/nix/store/4vzal97iq3dmrgycj8r0gflrh51p8w1s-bash-5.2p26/bin/bash
g++ -shared -fPIC --no-gnu-unique src/Flash.cpp src/IFocusAnimation.cpp src/Shrink.cpp src/main.cpp src/Flash.hpp src/IFocusAnimation.hpp src/Shrink.hpp  -o hyprfocus.so -g `pkg-config --cflags pixman-1 libdrm hyprland` -std=c++2b
In file included from src/Flash.hpp:3,
                 from src/Flash.cpp:1:
src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Flash.cpp: In member function 'virtual void CFlash::init(void*, std::string)':
src/Flash.cpp:10:77: error: C99 designator 'floatValue' outside aggregate initializer
   10 |     addConfigValue(pHandle, "flash_opacity", SConfigValue{.floatValue = 0.5f});
      |                                                                             ^
src/Flash.cpp:10:77: error: invalid use of incomplete type 'struct SConfigValue'
In file included from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/managers/HookSystemManager.hpp:12,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/protocols/Screencopy.hpp:8,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/protocols/ToplevelExport.hpp:6,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/managers/ProtocolManager.hpp:4,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/Compositor.hpp:18,
                 from src/Flash.cpp:3:
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/Flash.cpp: In member function 'virtual void CFlash::onWindowFocus(CWindow*, void*)':
src/Flash.cpp:16:25: error: 'getConfigValue' was not declared in this scope; did you mean 'HyprlandAPI::getConfigValue'?
   16 |     pWindow->m_fAlpha = getConfigValue(pHandle, "flash_opacity")->floatValue;
      |                         ^~~~~~~~~~~~~~
      |                         HyprlandAPI::getConfigValue
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:133:37: note: 'HyprlandAPI::getConfigValue' declared here
  133 |     APICALL Hyprlang::CConfigValue* getConfigValue(HANDLE handle, const std::string& name);
      |                                     ^~~~~~~~~~~~~~
src/Flash.cpp: In lambda function:
src/Flash.cpp:20:100: error: 'class Hyprlang::CConfigValue' has no member named 'floatValue'; did you mean 'getValue'?
   20 |             pWindow->m_fAlpha = HyprlandAPI::getConfigValue(pHandle, "decoration:active_opacity")->floatValue;
      |                                                                                                    ^~~~~~~~~~
      |                                                                                                    getValue
In file included from src/IFocusAnimation.cpp:1:
src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/IFocusAnimation.cpp: In member function 'virtual void IFocusAnimation::init(void*, std::string)':
src/IFocusAnimation.cpp:8:107: error: C99 designator 'strValue' outside aggregate initializer
    8 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "in_bezier",  SConfigValue{.strValue = "default"});
      |                                                                                                           ^
src/IFocusAnimation.cpp:8:107: error: invalid use of incomplete type 'struct SConfigValue'
In file included from src/IFocusAnimation.cpp:3:
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp:9:107: error: C99 designator 'strValue' outside aggregate initializer
    9 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "out_bezier", SConfigValue{.strValue = "default"});
      |                                                                                                           ^
src/IFocusAnimation.cpp:9:107: error: invalid use of incomplete type 'struct SConfigValue'
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp:11:102: error: C99 designator 'floatValue' outside aggregate initializer
   11 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "in_speed",  SConfigValue{.floatValue = 1.f});
      |                                                                                                      ^
src/IFocusAnimation.cpp:11:102: error: invalid use of incomplete type 'struct SConfigValue'
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp:12:102: error: C99 designator 'floatValue' outside aggregate initializer
   12 |     HyprlandAPI::addConfigValue(pHandle, configPrefix() + "out_speed", SConfigValue{.floatValue = 5.f});
      |                                                                                                      ^
src/IFocusAnimation.cpp:12:102: error: invalid use of incomplete type 'struct SConfigValue'
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/IFocusAnimation.cpp: In member function 'virtual void IFocusAnimation::onWindowFocus(CWindow*, void*)':
src/IFocusAnimation.cpp:26:117: error: 'class Hyprlang::CConfigValue' has no member named 'strValue'
   26 |     m_sFocusInAnimConfig.internalBezier       = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "in_bezier")->strValue;
      |                                                                                                                     ^~~~~~~~
src/IFocusAnimation.cpp:27:116: error: 'class Hyprlang::CConfigValue' has no member named 'floatValue'; did you mean 'getValue'?
   27 |     m_sFocusInAnimConfig.internalSpeed        = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "in_speed")->floatValue;
      |                                                                                                                    ^~~~~~~~~~
      |                                                                                                                    getValue
src/IFocusAnimation.cpp:29:118: error: 'class Hyprlang::CConfigValue' has no member named 'strValue'
   29 |     m_sFocusOutAnimConfig.internalBezier      = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "out_bezier")->strValue;
      |                                                                                                                      ^~~~~~~~
src/IFocusAnimation.cpp:30:117: error: 'class Hyprlang::CConfigValue' has no member named 'floatValue'; did you mean 'getValue'?
   30 |     m_sFocusOutAnimConfig.internalSpeed       = HyprlandAPI::getConfigValue(pHandle, configPrefix() + "out_speed")->floatValue;
      |                                                                                                                     ^~~~~~~~~~
      |                                                                                                                     getValue
src/IFocusAnimation.cpp: At global scope:
src/IFocusAnimation.cpp:33:6: error: no declaration matches 'void IFocusAnimation::addConfigValue(void*, std::string, SConfigValue)'
   33 | void IFocusAnimation::addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue) {
      |      ^~~~~~~~~~~~~~~
src/IFocusAnimation.hpp:12:21: note: candidate is: 'void IFocusAnimation::addConfigValue(void*, std::string, int)'
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                     ^~~~~~~~~~~~~~
src/IFocusAnimation.hpp:7:7: note: 'class IFocusAnimation' defined here
    7 | class IFocusAnimation {
      |       ^~~~~~~~~~~~~~~
src/IFocusAnimation.cpp:37:15: error: no declaration matches 'SConfigValue* IFocusAnimation::getConfigValue(void*, std::string)'
   37 | SConfigValue* IFocusAnimation::getConfigValue(HANDLE pHandle, std::string name) {
      |               ^~~~~~~~~~~~~~~
src/IFocusAnimation.cpp:37:15: note: no functions named 'SConfigValue* IFocusAnimation::getConfigValue(void*, std::string)'
src/IFocusAnimation.hpp:7:7: note: 'class IFocusAnimation' defined here
    7 | class IFocusAnimation {
      |       ^~~~~~~~~~~~~~~
In file included from src/Shrink.hpp:3,
                 from src/Shrink.cpp:1:
src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Shrink.hpp:10:5: error: invalid use of template-name 'CAnimatedVariable' without an argument list
   10 |     CAnimatedVariable m_sShrinkAnimation;
      |     ^~~~~~~~~~~~~~~~~
src/Shrink.cpp: In member function 'virtual void CShrink::init(void*, std::string)':
src/Shrink.cpp:10:81: error: C99 designator 'floatValue' outside aggregate initializer
   10 |     addConfigValue(pHandle, "shrink_percentage", SConfigValue{.floatValue = 0.5f});
      |                                                                                 ^
src/Shrink.cpp:10:81: error: invalid use of incomplete type 'struct SConfigValue'
In file included from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/managers/HookSystemManager.hpp:12,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/protocols/Screencopy.hpp:8,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/protocols/ToplevelExport.hpp:6,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/managers/ProtocolManager.hpp:4,
                 from /nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/Compositor.hpp:18,
                 from src/Shrink.cpp:3:
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/Shrink.cpp: In member function 'virtual void CShrink::onWindowFocus(CWindow*, void*)':
src/Shrink.cpp:20:35: error: 'getConfigValue' was not declared in this scope; did you mean 'HyprlandAPI::getConfigValue'?
   20 |     const auto SHRINKPERCENTAGE = getConfigValue(pHandle, "shrink_percentage")->floatValue;
      |                                   ^~~~~~~~~~~~~~
      |                                   HyprlandAPI::getConfigValue
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:133:37: note: 'HyprlandAPI::getConfigValue' declared here
  133 |     APICALL Hyprlang::CConfigValue* getConfigValue(HANDLE handle, const std::string& name);
      |                                     ^~~~~~~~~~~~~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:30:68: error: 'class CAnimatedVariable<Vector2D>' has no member named 'goalv'; did you mean 'goal'?
   30 |                 const auto GOALPOS      = pWindow->m_vRealPosition.goalv();
      |                                                                    ^~~~~
      |                                                                    goal
src/Shrink.cpp:31:64: error: 'class CAnimatedVariable<Vector2D>' has no member named 'goalv'; did you mean 'goal'?
   31 |                 const auto GOALSIZE     = pWindow->m_vRealSize.goalv();
      |                                                                ^~~~~
      |                                                                goal
src/Shrink.cpp:33:61: error: missing template arguments before '*' token
   33 |                 const auto* PANIMATION  = (CAnimatedVariable*)pShrinkAnimation;
      |                                                             ^
src/Shrink.cpp:33:62: error: expected primary-expression before ')' token
   33 |                 const auto* PANIMATION  = (CAnimatedVariable*)pShrinkAnimation;
      |                                                              ^
src/Shrink.cpp:36:99: error: 'class CAnimatedVariable<Vector2D>' has no member named 'vec'
   36 |                 pWindow->m_vRealPosition.setValue(GOALPOS + GOALSIZE / 2.f - pWindow->m_vRealSize.vec() / 2.f);
      |                                                                                                   ^~~
src/Shrink.cpp: In lambda function:
src/Shrink.cpp:40:36: error: missing template arguments before '*' token
   40 |                 ((CAnimatedVariable*)pShrinkAnimation)->resetAllCallbacks();
      |                                    ^
src/Shrink.cpp:40:37: error: expected primary-expression before ')' token
   40 |                 ((CAnimatedVariable*)pShrinkAnimation)->resetAllCallbacks();
      |                                     ^
src/Shrink.cpp:40:38: error: expected ')' before 'pShrinkAnimation'
   40 |                 ((CAnimatedVariable*)pShrinkAnimation)->resetAllCallbacks();
      |                 ~                    ^~~~~~~~~~~~~~~~
      |                                      )
In file included from src/main.cpp:12:
src/Shrink.hpp:10:5: error: invalid use of template-name 'CAnimatedVariable' without an argument list
   10 |     CAnimatedVariable m_sShrinkAnimation;
      |     ^~~~~~~~~~~~~~~~~
src/main.cpp: In function 'void flashWindow(CWindow*)':
src/main.cpp:22:128: error: 'class Hyprlang::CConfigValue' has no member named 'strValue'
   22 |     auto* const PTYPE = g_bMouseWasPressed  ? &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:mouse_focus_animation")->strValue
      |                                                                                                                                ^~~~~~~~
src/main.cpp:23:131: error: 'class Hyprlang::CConfigValue' has no member named 'strValue'
   23 |                                             : &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:keyboard_focus_animation")->strValue;
      |                                                                                                                                   ^~~~~~~~
src/main.cpp: In function 'void flashCurrentWindow(std::string)':
src/main.cpp:29:111: error: 'class Hyprlang::CConfigValue' has no member named 'intValue'; did you mean 'getValue'?
   29 |     static auto* const PHYPRFOCUSENABLED = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:enabled")->intValue;
      |                                                                                                               ^~~~~~~~
      |                                                                                                               getValue
src/main.cpp: In function 'void onActiveWindowChange(void*, std::any)':
src/main.cpp:43:115: error: 'class Hyprlang::CConfigValue' has no member named 'intValue'; did you mean 'getValue'?
   43 |         static auto* const PHYPRFOCUSENABLED = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprfocus:enabled")->intValue;
      |                                                                                                                   ^~~~~~~~
      |                                                                                                                   getValue
src/main.cpp: In function 'void onMouseButton(void*, std::any)':
src/main.cpp:63:58: warning: comparison between 'enum wl_pointer_button_state' and 'enum wlr_button_state' [-Wenum-compare]
   63 |         g_bMouseWasPressed = PWLRMOUSEBUTTONEVENT->state == WLR_BUTTON_PRESSED;
      |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
src/main.cpp: In function 'PLUGIN_DESCRIPTION_INFO pluginInit(void*)':
src/main.cpp:76:121: error: C99 designator 'intValue' outside aggregate initializer
   76 |     HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:enabled",                    SConfigValue{.intValue = 0      });
      |                                                                                                                         ^
src/main.cpp:76:121: error: invalid use of incomplete type 'struct SConfigValue'
In file included from src/main.cpp:3:
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/main.cpp:77:121: error: C99 designator 'strValue' outside aggregate initializer
   77 |     HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:keyboard_focus_animation",   SConfigValue{.strValue = "flash"});
      |                                                                                                                         ^
src/main.cpp:77:121: error: invalid use of incomplete type 'struct SConfigValue'
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/main.cpp:78:121: error: C99 designator 'strValue' outside aggregate initializer
   78 |     HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:mouse_focus_animation",      SConfigValue{.strValue = "flash"});
      |                                                                                                                         ^
src/main.cpp:78:121: error: invalid use of incomplete type 'struct SConfigValue'
/nix/store/42y0560kgag83dlkj3g1nb4iakkpkljd-hyprland-0.36.0+date=2024-03-13_3e67ee0-dev/include/hyprland/src/plugins/PluginAPI.hpp:63:8: note: forward declaration of 'struct SConfigValue'
   63 | struct SConfigValue;
      |        ^~~~~~~~~~~~
src/Flash.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
In file included from src/Flash.hpp:3:
src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/IFocusAnimation.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Shrink.hpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
In file included from src/Shrink.hpp:3:
src/IFocusAnimation.hpp:12:70: error: 'SConfigValue' has not been declared
   12 |     void            addConfigValue(HANDLE pHandle, std::string name, SConfigValue sValue);
      |                                                                      ^~~~~~~~~~~~
src/IFocusAnimation.hpp:13:5: error: 'SConfigValue' does not name a type
   13 |     SConfigValue*   getConfigValue(HANDLE pHandle, std::string name);
      |     ^~~~~~~~~~~~
src/Shrink.hpp:10:5: error: invalid use of template-name 'CAnimatedVariable' without an argument list
   10 |     CAnimatedVariable m_sShrinkAnimation;
      |     ^~~~~~~~~~~~~~~~~
make: *** [Makefile:4: all] Error 1

Do not build with 0.39.1

Hi

Hyprland made a lot of modification to headers recently.
The plugin does not compile unfortunately.
Would it be possible to update it ?

I guess this is not working

2024-01-29_21-01-24.mp4

and can u pls provide your hyprland.conf? coz when u switch active windows, your cursor doesnt move to the center idk mine centers always for

# Move focus with s + arrow keys
binde = $s, left, movefocus, l
binde = $s, right, movefocus, r
binde = $s, up, movefocus, u
binde = $s, down, movefocus, d

so what do u do?

hyprpm reload hyprfocus -n -v
[v] version returned: Hyprland, built from branch main at commit 91e8c428431deac1e5eb8e537f002ab960777174 dirty (hyprpm: don't update headers if they are up-to-date, only recompile).
Date: Mon Jan 29 16:00:31 2024
Tag: v0.34.0-80-g91e8c428

flags: (if any)


[v] parsed commit 91e8c428431deac1e5eb8e537f002ab960777174 at branch main
✔ Ensuring plugin load state
✔ Unloaded hycov
✔ Plugin load state ensured

so idk whats the problem it loads but doesnt work

Build error

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

swappy-20240227-130457
swappy-20240227-130646

With hyprpm

swappy-20240227-163855

Color flash

wondering if you could make a flash where instead of flashing the transparency, it would flash to a certain color instead. thanks

Opacity set permanently when using flash

Hey, thanks for creating this plugin, just a little problem with the flash effect.
When set, it changes the active/inactive_opacity of the affected windows permanently until they are closed and effect is disabled.

before applying effect
before applying effect

after applying effect
after applying effect

btw i tried setting different flash_opacity values in the plugin section, all with the same results

full settings used
settings

Some options loss!

图片
When i install hyprfocus, decoration rounding and opacity is not working.

❯ hyprctl plugin list

Plugin hyprfocus by Vortex:
Handle: 55ea1e16a190
Version: 2.0
Description: animate windows on focus

❯ hyprctl version
Hyprland, built from branch main at commit d70cc88dab11bc6d1095523a0ce655dff40b27a2 dirty (meson: generate version.h before install_headers (3612)).
Tag: v0.31.0-8-gd70cc88d

flags: (if any)
debug

❯ yay -Q | grep hyprland
hyprland-hidpi-xprop-git 0.31.0.r8.d70cc88d-1

I can't build hyprfocus using hyprpm

Here's output of hyprpm add https://github.com/hyprwm/hyprland-plugins

✔ adding a new plugin repository from https://github.com/hyprwm/hyprland-plugins
  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/hyprwm/hyprland-plugins
✔ cloned
✔ found hyprpm manifest
✔ parsed manifest, found 6 plugins:
 → borders-plus-plus by Vaxry version
 → csgo-vulkan-fix by Vaxry version
 → hyprbars by Vaxry version
 → hyprexpo by Vaxry version
 → hyprtrails by Vaxry version
 → hyprwinwrap by Vaxry version
 → Manifest has 8 pins, checking
✔ commit pin e45066d0741a1a4b9298a4c5ec43a5e57b059a4e matched hl, resetting
✔ Hyprland headers OK
 → Building borders-plus-plus
✔ built borders-plus-plus into borders-plus-plus/borders-plus-plus.so
 → Building csgo-vulkan-fix
✔ built csgo-vulkan-fix into csgo-vulkan-fix/csgo-vulkan-fix.so
 → Building hyprbars
✔ built hyprbars into hyprbars/hyprbars.so
 → Building hyprexpo
✖ Plugin hyprexpo failed to build.

 → Building hyprtrails
✔ built hyprtrails into hyprtrails/hyprtrails.so
 → Building hyprwinwrap
✔ built hyprwinwrap into hyprwinwrap/hyprwinwrap.so
✔ all plugins built
✔ installed repository
✔ you can now enable the plugin(s) with hyprpm enable
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  5 / 5  Done!

and I did not give where it went wrong, so in order to do it again with -v option, I removed hyprfocus. But when I try to add again, it says repository already installed. - Could not clone the plugin repository. Repository already installed.

When I hyprpm list hyprfocus does not show up.

 → Repository hyprland-plugins:
  │ Plugin borders-plus-plus
  └─ enabled: false
  │ Plugin csgo-vulkan-fix
  └─ enabled: false
  │ Plugin hyprbars
  └─ enabled: false
  │ Plugin hyprexpo
  └─ enabled: Plugin failed to build
  │ Plugin hyprtrails
  └─ enabled: false
  │ Plugin hyprwinwrap
  └─ enabled: false

How can I resolve the issue? Thanks

Glow effect of focues window

Is it possible to create a constant glow effect of the focused window? Like a slowly glowing border ...

Not sure if this annoying distracting ... 😄

Hey @VortexCoyote, i wanted to ask if i can disable animations on float windows?

I would love to disable these flash/shrink animations on float windows as i use scratchpads and when i open or close them, it flashes like i cant tolerate it...

so this may be more of a feature request-> disable animations when using floating windows like: when opening windows, no flash/shrink, and when returning to tiled window, dont flash like i dont like this behavior

2024-02-15_14-04-54.mp4

Keyboard focus animation is always used

I changed mouse_focus_animation to nothing and keyboard_focus_animation to flash. When I focus using mouse (touchpad actually) it still plays flash animation. If I change keyboard focus animation to shrink, it plays shrink over mouse too.

Config:

plugin = /home/user/Documents/hyprland_plugins/hyprfocus.so

plugin:hyprfocus {
    enabled = yes

    keyboard_focus_animation = flash
    mouse_focus_animation = nothing

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

    flash {
        flash_opacity = 0.8

        in_bezier = bezIn
        in_speed = 0.5

        out_bezier = bezOut
        out_speed = 2
    }

    shrink {
        shrink_percentage = 0.9

        in_bezier = bezIn
        in_speed = 0.5

        out_bezier = bezOut
        out_speed = 3
    }
}

Hyprland version: 0.28.0
Hyprfocus version: 69f3f23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.