Skip to content

Commit

Permalink
input: don't remove pinned focus on workspace change (hyprwm#5486)
Browse files Browse the repository at this point in the history
modified:   src/helpers/Monitor.cpp
  • Loading branch information
MightyPlaza authored and lisuke committed Apr 15, 2024
1 parent 70ee68b commit 7654667
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/helpers/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
w->moveToWorkspace(pWorkspace);
}

if (!noFocus && !g_pCompositor->m_pLastMonitor->activeSpecialWorkspace) {
if (!noFocus && !g_pCompositor->m_pLastMonitor->activeSpecialWorkspace &&
!(g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_iMonitorID == ID)) {
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
CWindow* pWindow = pWorkspace->getLastFocusedWindow();

Expand Down Expand Up @@ -627,10 +628,12 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {

g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);

if (const auto PLAST = activeWorkspace->getLastFocusedWindow(); PLAST)
g_pCompositor->focusWindow(PLAST);
else
g_pInputManager->refocus();
if (!(g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_iMonitorID == ID)) {
if (const auto PLAST = activeWorkspace->getLastFocusedWindow(); PLAST)
g_pCompositor->focusWindow(PLAST);
else
g_pInputManager->refocus();
}

g_pCompositor->updateFullscreenFadeOnWorkspace(activeWorkspace);

Expand Down Expand Up @@ -693,10 +696,12 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {

g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);

if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST)
g_pCompositor->focusWindow(PLAST);
else
g_pInputManager->refocus();
if (!(g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bPinned && g_pCompositor->m_pLastWindow->m_iMonitorID == ID)) {
if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST)
g_pCompositor->focusWindow(PLAST);
else
g_pInputManager->refocus();
}

g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", pWorkspace->m_szName + "," + szName});

Expand Down

0 comments on commit 7654667

Please sign in to comment.