From 14176f01ca5c584cc17db2dea3d0968c05d8cc01 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 25 Jul 2022 15:42:27 +0200 Subject: [PATCH] fix swiping with one workspace on monitor --- src/managers/input/Swipe.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/managers/input/Swipe.cpp b/src/managers/input/Swipe.cpp index e3c1b9ea1..bde806d30 100644 --- a/src/managers/input/Swipe.cpp +++ b/src/managers/input/Swipe.cpp @@ -9,6 +9,16 @@ void CInputManager::onSwipeBegin(wlr_pointer_swipe_begin_event* e) { if (e->fingers != *PSWIPEFINGERS|| *PSWIPE == 0) return; + int onMonitor = 0; + for (auto& w : g_pCompositor->m_vWorkspaces) { + if (w->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID) { + onMonitor++; + } + } + + if (onMonitor < 2) + return; // disallow swiping when there's 1 workspace on a monitor + const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace); Debug::log(LOG, "Starting a swipe from %s", PWORKSPACE->m_szName.c_str());