-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
socket2: add {,de}populateworkspace events #12488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aytizren
wants to merge
2
commits into
hyprwm:main
Choose a base branch
from
aytizren:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -470,6 +470,8 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { | |
|
|
||
| const auto OLDWORKSPACE = m_workspace; | ||
|
|
||
| bool previouslyEmpty = !pWorkspace->hasWindow(); | ||
|
|
||
| if (OLDWORKSPACE->isVisible()) { | ||
| m_movingToWorkspaceAlpha->setValueAndWarp(1.F); | ||
| *m_movingToWorkspaceAlpha = 0.F; | ||
|
|
@@ -495,6 +497,16 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { | |
| g_pEventManager->postEvent(SHyprIPCEvent{.event = "movewindow", .data = std::format("{:x},{}", rc<uintptr_t>(this), pWorkspace->m_name)}); | ||
| g_pEventManager->postEvent(SHyprIPCEvent{.event = "movewindowv2", .data = std::format("{:x},{},{}", rc<uintptr_t>(this), pWorkspace->m_id, pWorkspace->m_name)}); | ||
| EMIT_HOOK_EVENT("moveWindow", (std::vector<std::any>{m_self.lock(), pWorkspace})); | ||
|
|
||
| if (!OLDWORKSPACE->hasWindow()) { | ||
| g_pEventManager->postEvent(SHyprIPCEvent{.event = "depopulateworkspace", .data = std::format("{},{}", OLDWORKSPACE->m_id, OLDWORKSPACE->m_name)}); | ||
| EMIT_HOOK_EVENT("depopulateWorkspace", OLDWORKSPACE); | ||
| } | ||
|
|
||
| if (previouslyEmpty) { | ||
| g_pEventManager->postEvent(SHyprIPCEvent{.event = "populateworkspace", .data = std::format("{},{}", pWorkspace->m_id, pWorkspace->m_name)}); | ||
| EMIT_HOOK_EVENT("populateWorkspace", pWorkspace); | ||
| } | ||
| } | ||
|
|
||
| if (const auto SWALLOWED = m_swallowed.lock()) { | ||
|
|
@@ -504,7 +516,7 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) { | |
| } | ||
| } | ||
|
|
||
| if (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_id) && OLDWORKSPACE->getWindows() == 0 && *PCLOSEONLASTSPECIAL) { | ||
| if (OLDWORKSPACE && g_pCompositor->isWorkspaceSpecial(OLDWORKSPACE->m_id) && !OLDWORKSPACE->hasWindow() && *PCLOSEONLASTSPECIAL) { | ||
| if (const auto PMONITOR = OLDWORKSPACE->m_monitor.lock(); PMONITOR) | ||
| PMONITOR->setSpecialWorkspace(nullptr); | ||
| } | ||
|
|
@@ -559,10 +571,10 @@ void CWindow::onUnmap() { | |
| // if the special workspace now has 0 windows, it will be closed, and this | ||
| // window will no longer pass render checks, cuz the workspace will be nuked. | ||
| // throw it into the main one for the fadeout. | ||
| if (m_workspace->m_isSpecialWorkspace && m_workspace->getWindows() == 0) | ||
| if (m_workspace->m_isSpecialWorkspace && !m_workspace->hasWindow()) | ||
| m_lastWorkspace = m_monitor->activeWorkspaceID(); | ||
|
|
||
| if (*PCLOSEONLASTSPECIAL && m_workspace && m_workspace->getWindows() == 0 && onSpecialWorkspace()) { | ||
| if (*PCLOSEONLASTSPECIAL && m_workspace && !m_workspace->hasWindow() && onSpecialWorkspace()) { | ||
| const auto PMONITOR = m_monitor.lock(); | ||
| if (PMONITOR && PMONITOR->m_activeSpecialWorkspace && PMONITOR->m_activeSpecialWorkspace == m_workspace) | ||
| PMONITOR->setSpecialWorkspace(nullptr); | ||
|
|
@@ -1936,7 +1948,9 @@ void CWindow::mapWindow() { | |
| Desktop::focusState()->rawMonitorFocus(g_pCompositor->getMonitorFromVector({})); | ||
| PMONITOR = Desktop::focusState()->monitor(); | ||
| } | ||
| auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace; | ||
| auto PWORKSPACE = PMONITOR->m_activeSpecialWorkspace ? PMONITOR->m_activeSpecialWorkspace : PMONITOR->m_activeWorkspace; | ||
| bool workspacePreviouslyEmpty = !PWORKSPACE->hasWindow(); | ||
|
|
||
| m_monitor = PMONITOR; | ||
| m_workspace = PWORKSPACE; | ||
| m_isMapped = true; | ||
|
|
@@ -2233,6 +2247,9 @@ void CWindow::mapWindow() { | |
| // emit the IPC event before the layout might focus the window to avoid a focus event first | ||
| g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", std::format("{:x},{},{},{}", m_self.lock(), PWORKSPACE->m_name, m_class, m_title)}); | ||
| EMIT_HOOK_EVENT("openWindowEarly", m_self.lock()); | ||
| if (workspacePreviouslyEmpty) { | ||
| g_pEventManager->postEvent(SHyprIPCEvent{"populateworkspace", std::format("{},{}", PWORKSPACE->m_id, PWORKSPACE->m_name)}); | ||
| } | ||
|
|
||
| if (m_isFloating) { | ||
| g_pLayoutManager->getCurrentLayout()->onWindowCreated(m_self.lock()); | ||
|
|
@@ -2373,6 +2390,10 @@ void CWindow::mapWindow() { | |
|
|
||
| // emit the hook event here after basic stuff has been initialized | ||
| EMIT_HOOK_EVENT("openWindow", m_self.lock()); | ||
| if (workspacePreviouslyEmpty) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no {} |
||
| EMIT_HOOK_EVENT("populateWorkspace", m_self.lock()); | ||
| } | ||
|
|
||
|
|
||
| // apply data from default decos. Borders, shadows. | ||
| g_pDecorationPositioner->forceRecalcFor(m_self.lock()); | ||
|
|
@@ -2485,6 +2506,11 @@ void CWindow::unmapWindow() { | |
| // do this after onWindowRemoved because otherwise it'll think the window is invalid | ||
| m_isMapped = false; | ||
|
|
||
| if (!m_workspace->hasWindow()) { | ||
| g_pEventManager->postEvent(SHyprIPCEvent{"depopulateworkspace", std::format("{},{}", m_workspace->m_id, m_workspace->m_name)}); | ||
| EMIT_HOOK_EVENT("depopulateWorkspace", m_workspace); | ||
| } | ||
|
|
||
| // refocus on a new window if needed | ||
| if (wasLastWindow) { | ||
| static auto FOCUSONCLOSE = CConfigValue<Hyprlang::INT>("input:focus_on_close"); | ||
|
|
@@ -2503,7 +2529,7 @@ void CWindow::unmapWindow() { | |
| g_pCompositor->setWindowFullscreenInternal(PWINDOWCANDIDATE, CURRENTFSMODE); | ||
| } | ||
|
|
||
| if (!PWINDOWCANDIDATE && m_workspace && m_workspace->getWindows() == 0) | ||
| if (!PWINDOWCANDIDATE && m_workspace && !m_workspace->hasWindow()) | ||
| g_pInputManager->refocus(); | ||
|
|
||
| g_pInputManager->sendMotionEventsToFocused(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no {}