hyprfocus: add only_on_monitor_change option (#538)

This commit is contained in:
Eleonora 2025-11-15 20:13:23 +01:00 committed by GitHub
parent befb267080
commit 8c1212e96b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View file

@ -14,9 +14,10 @@ animation = hyprfocusOut, 1, 1.7, myCurve2
### Variables
| name | description | type | default |
| --- | --- | --- | --- |
|mode|which mode to use (flash / bounce / slide) | str | flash |
| fade_opacity | for flash, what opacity to flash to | float | 0.8 |
| bounce_strength | for bounce, what fraction of the window's size to jump to | float | 0.95 |
| slide_height | for slide, how far up to slide | float | 20 |
| name | description | type | default |
|--------------------------|----------------------------------------------------------------------|---------|---------|
| `mode` | which mode to use (flash / bounce / slide) | str | flash |
| `only_on_monitor_change` | whether to only perform the animation when changing between monitors | boolean | false |
| `fade_opacity` | for flash, what opacity to flash to | float | 0.8 |
| `bounce_strength` | for bounce, what fraction of the window's size to jump to | float | 0.95 |
| `slide_height` | for slide, how far up to slide | float | 20 |

View file

@ -38,6 +38,10 @@ static void onFocusChange(PHLWINDOW window) {
if (lastWindow == window)
return;
static const auto PONLY_ON_MONITOR_CHANGE = CConfigValue<Hyprlang::INT>("plugin:hyprfocus:only_on_monitor_change");
if (*PONLY_ON_MONITOR_CHANGE && lastWindow && lastWindow->m_monitor == window->m_monitor)
return;
lastWindow = window;
static const auto POPACITY = CConfigValue<Hyprlang::FLOAT>("plugin:hyprfocus:fade_opacity");
@ -124,6 +128,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
// clang-format on
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:mode", Hyprlang::STRING{"flash"});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:only_on_monitor_change", Hyprlang::INT{0});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:fade_opacity", Hyprlang::FLOAT{0.8F});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:slide_height", Hyprlang::FLOAT{20.F});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprfocus:bounce_strength", Hyprlang::FLOAT{0.95F});