summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authorMightyPlaza <123664421+MightyPlaza@users.noreply.github.com>2023-09-04 13:11:51 +0000
committerGitHub <noreply@github.com>2023-09-04 15:11:51 +0200
commit6a0e2bbff36ad53b08289c150925f1037f856475 (patch)
tree2e59580d52bf8ba0fa06966a574faad4b983f42a /src/helpers/Monitor.cpp
parent32f75ebb701f424e638a51c56860315fe000dd19 (diff)
socket2: added "activespecial" IPC event (#3163)
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index bdd56196..aee9a0da 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -572,8 +572,10 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
if (!pWorkspace) {
// remove special if exists
- if (const auto EXISTINGSPECIAL = g_pCompositor->getWorkspaceByID(specialWorkspaceID); EXISTINGSPECIAL)
+ if (const auto EXISTINGSPECIAL = g_pCompositor->getWorkspaceByID(specialWorkspaceID); EXISTINGSPECIAL) {
EXISTINGSPECIAL->startAnim(false, false);
+ g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", "," + szName});
+ }
specialWorkspaceID = 0;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
@@ -592,10 +594,21 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
EXISTINGSPECIAL->startAnim(false, false);
}
+ bool animate = true;
+ //close if open elsewhere
+ const auto PMONITORWORKSPACEOWNER = g_pCompositor->getMonitorFromID(pWorkspace->m_iMonitorID);
+ if (PMONITORWORKSPACEOWNER->specialWorkspaceID == pWorkspace->m_iID) {
+ PMONITORWORKSPACEOWNER->specialWorkspaceID = 0;
+ g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITORWORKSPACEOWNER->ID);
+ g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", "," + PMONITORWORKSPACEOWNER->szName});
+ animate = false;
+ }
+
// open special
pWorkspace->m_iMonitorID = ID;
specialWorkspaceID = pWorkspace->m_iID;
- pWorkspace->startAnim(true, true);
+ if (animate)
+ pWorkspace->startAnim(true, true);
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_iWorkspaceID == pWorkspace->m_iID) {
@@ -610,6 +623,8 @@ void CMonitor::setSpecialWorkspace(CWorkspace* const pWorkspace) {
g_pCompositor->focusWindow(PLAST);
else
g_pInputManager->refocus();
+
+ g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", pWorkspace->m_szName + "," + szName});
}
void CMonitor::setSpecialWorkspace(const int& id) {