diff options
author | Roberto Previdi <[email protected]> | 2023-10-09 21:28:22 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-10-09 20:28:22 +0100 |
commit | df0c8e0f7a580e18eebbe934c00124a08b426583 (patch) | |
tree | e0de7483d6033eec97eead60deeae503d4603857 | |
parent | 7f8e0a131883ffa44ce85b2353873c2257aebbf7 (diff) | |
download | Hyprland-df0c8e0f7a580e18eebbe934c00124a08b426583.tar.gz Hyprland-df0c8e0f7a580e18eebbe934c00124a08b426583.zip |
workspacerules: Add a persistent workspace rule (#3530)
* add persistent flag to workspace rules
* get rid of unused ws->indestructible flag
-rw-r--r-- | src/Compositor.cpp | 5 | ||||
-rw-r--r-- | src/config/ConfigManager.cpp | 2 | ||||
-rw-r--r-- | src/config/ConfigManager.hpp | 1 | ||||
-rw-r--r-- | src/helpers/Workspace.hpp | 3 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 66306888..42c2ab35 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1188,8 +1188,11 @@ void CCompositor::sanityCheckWorkspaces() { auto it = m_vWorkspaces.begin(); while (it != m_vWorkspaces.end()) { - if ((*it)->m_bIndestructible) + const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(it->get()); + if (WORKSPACERULE.isPersistent) { + ++it; continue; + } const auto WINDOWSONWORKSPACE = getWindowsOnWorkspace((*it)->m_iID); diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 23efe77e..f21ad9f3 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -1177,6 +1177,8 @@ void CConfigManager::handleWorkspaceRules(const std::string& command, const std: wsRule.monitor = rule.substr(delim + 8); else if ((delim = rule.find("default:")) != std::string::npos) wsRule.isDefault = configStringToInt(rule.substr(delim + 8)); + else if ((delim = rule.find("persistent:")) != std::string::npos) + wsRule.isPersistent = configStringToInt(rule.substr(delim + 11)); }; size_t pos = 0; diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp index 390079d3..e637979d 100644 --- a/src/config/ConfigManager.hpp +++ b/src/config/ConfigManager.hpp @@ -41,6 +41,7 @@ struct SWorkspaceRule { std::string workspaceName = ""; int workspaceId = -1; bool isDefault = false; + bool isPersistent = false; std::optional<int64_t> gapsIn; std::optional<int64_t> gapsOut; std::optional<int64_t> borderSize; diff --git a/src/helpers/Workspace.hpp b/src/helpers/Workspace.hpp index 2e810b9a..cbdbc07a 100644 --- a/src/helpers/Workspace.hpp +++ b/src/helpers/Workspace.hpp @@ -50,9 +50,6 @@ class CWorkspace { bool m_bDefaultFloating = false; bool m_bDefaultPseudo = false; - // don't destroy in sanity check - bool m_bIndestructible = false; - // last monitor (used on reconnect) std::string m_szLastMonitor = ""; |