mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2024-11-24 03:05:58 +01:00
expo: add swipe gesture to close overview (#186)
This commit is contained in:
parent
d92d9d6cd9
commit
667ea74c36
1 changed files with 18 additions and 8 deletions
|
@ -87,10 +87,15 @@ static void swipeUpdate(void* self, SCallbackInfo& info, std::any param) {
|
|||
|
||||
info.cancelled = true;
|
||||
if (!swipeActive) {
|
||||
if (g_pOverview)
|
||||
return;
|
||||
if ((**PPOSITIVE ? 1.0 : -1.0) * e.delta.y <= 0)
|
||||
return;
|
||||
if (g_pOverview && (**PPOSITIVE ? 1.0 : -1.0) * e.delta.y <= 0) {
|
||||
renderingOverview = true;
|
||||
g_pOverview = std::make_unique<COverview>(g_pCompositor->m_pLastMonitor->activeWorkspace, true);
|
||||
renderingOverview = false;
|
||||
gestured = 300;
|
||||
swipeActive = true;
|
||||
}
|
||||
|
||||
else if (!g_pOverview && (**PPOSITIVE ? 1.0 : -1.0) * e.delta.y > 0) {
|
||||
renderingOverview = true;
|
||||
g_pOverview = std::make_unique<COverview>(g_pCompositor->m_pLastMonitor->activeWorkspace, true);
|
||||
renderingOverview = false;
|
||||
|
@ -98,6 +103,11 @@ static void swipeUpdate(void* self, SCallbackInfo& info, std::any param) {
|
|||
swipeActive = true;
|
||||
}
|
||||
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gestured += (**PPOSITIVE ? 1.0 : -1.0) * e.delta.y;
|
||||
if (gestured <= 0.01) // plugin will crash if swipe ends at <= 0
|
||||
gestured = 0.01;
|
||||
|
|
Loading…
Reference in a new issue