diff options
| author | Maxim Baz <git@maximbaz.com> | 2023-01-14 20:31:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-14 20:31:11 +0100 |
| commit | 668d90c70093ce10816ba525780988e848f8d4af (patch) | |
| tree | c58e18aa7f559847133439521532cedc5a289566 /src/Compositor.cpp | |
| parent | b3012d97ab32abb6915f6ed496a04e206a9f0b0b (diff) | |
Implement urgency hint for workspaces (#1379)
When there are any unfocused windows that request activation, mark the workspace as urgent.
Diffstat (limited to 'src/Compositor.cpp')
| -rw-r--r-- | src/Compositor.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 2e331ad7..e44632c1 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -826,6 +826,17 @@ void CCompositor::focusWindow(CWindow* pWindow, wlr_surface* pSurface) { updateWindowAnimatedDecorationValues(pWindow); + // Handle urgency hint on the workspace + if (pWindow->m_bIsUrgent) { + pWindow->m_bIsUrgent = false; + if (!hasUrgentWindowOnWorkspace(pWindow->m_iWorkspaceID)) { + const auto PWORKSPACE = getWorkspaceByID(pWindow->m_iWorkspaceID); + if (PWORKSPACE->m_pWlrHandle) { + wlr_ext_workspace_handle_v1_set_urgent(PWORKSPACE->m_pWlrHandle, 0); + } + } + } + // Send an event g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(pWindow) + "," + pWindow->m_szTitle}); @@ -1046,6 +1057,15 @@ int CCompositor::getWindowsOnWorkspace(const int& id) { return no; } +bool CCompositor::hasUrgentWindowOnWorkspace(const int& id) { + for (auto& w : m_vWindows) { + if (w->m_iWorkspaceID == id && w->m_bIsMapped && w->m_bIsUrgent) + return true; + } + + return false; +} + CWindow* CCompositor::getFirstWindowOnWorkspace(const int& id) { for (auto& w : m_vWindows) { if (w->m_iWorkspaceID == id && w->m_bIsMapped && !w->isHidden()) |
