windowrules: add option to allow size persistence between app launches (#9422)

This commit is contained in:
nyx
2025-03-07 20:12:02 -05:00
committed by GitHub
parent 4082e876d5
commit b80b64cd6c
7 changed files with 78 additions and 15 deletions

View File

@@ -2954,3 +2954,18 @@ std::string SConfigOptionDescription::jsonify() const {
void CConfigManager::ensurePersistentWorkspacesPresent() {
g_pCompositor->ensurePersistentWorkspacesPresent(m_vWorkspaceRules);
}
void CConfigManager::storeFloatingSize(PHLWINDOW window, const Vector2D& size) {
Debug::log(LOG, "storing floating size {}x{} for window {}::{}", size.x, size.y, window->m_szClass, window->m_szTitle);
SFloatCache id{window};
m_mStoredFloatingSizes[id] = size;
}
std::optional<Vector2D> CConfigManager::getStoredFloatingSize(PHLWINDOW window) {
SFloatCache id{window};
if (m_mStoredFloatingSizes.contains(id)) {
Debug::log(LOG, "got stored size {}x{} for window {}::{}", m_mStoredFloatingSizes[id].x, m_mStoredFloatingSizes[id].y, window->m_szClass, window->m_szTitle);
return m_mStoredFloatingSizes[id];
}
return std::nullopt;
}