mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-14 03:25:45 -07:00
tokens: add more modes to initial_workspace_tracking
1 is single-shot, 2 is persistent fixes #5732
This commit is contained in:
@@ -385,9 +385,20 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
||||
if (m_pWorkspace == pWorkspace)
|
||||
return;
|
||||
|
||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
||||
|
||||
if (!m_szInitialWorkspaceToken.empty()) {
|
||||
g_pTokenManager->removeToken(g_pTokenManager->getToken(m_szInitialWorkspaceToken));
|
||||
m_szInitialWorkspaceToken = "";
|
||||
const auto TOKEN = g_pTokenManager->getToken(m_szInitialWorkspaceToken);
|
||||
if (TOKEN) {
|
||||
if (*PINITIALWSTRACKING == 2) {
|
||||
// persistent
|
||||
SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->data);
|
||||
if (token.primaryOwner == this) {
|
||||
token.workspace = pWorkspace->getConfigName();
|
||||
TOKEN->data = token;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static auto PCLOSEONLASTSPECIAL = CConfigValue<Hyprlang::INT>("misc:close_special_on_empty");
|
||||
@@ -468,6 +479,20 @@ void CWindow::onUnmap() {
|
||||
if (g_pInputManager->currentlyDraggedWindow == this)
|
||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
||||
|
||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
||||
|
||||
if (!m_szInitialWorkspaceToken.empty()) {
|
||||
const auto TOKEN = g_pTokenManager->getToken(m_szInitialWorkspaceToken);
|
||||
if (TOKEN) {
|
||||
if (*PINITIALWSTRACKING == 2) {
|
||||
// persistent token, but the first window got removed so the token is gone
|
||||
SInitialWorkspaceToken token = std::any_cast<SInitialWorkspaceToken>(TOKEN->data);
|
||||
if (token.primaryOwner == this)
|
||||
g_pTokenManager->removeToken(TOKEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_iLastWorkspace = m_pWorkspace->m_iID;
|
||||
|
||||
m_vRealPosition.setCallbackOnEnd(unregisterVar);
|
||||
|
Reference in New Issue
Block a user