mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2025-12-28 19:00:05 +01:00
hyprfocus: add only_on_monitor_change option (#538)
This commit is contained in:
parent
befb267080
commit
8c1212e96b
2 changed files with 12 additions and 6 deletions
|
|
@ -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 |
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue