mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-09-16 08:18:23 +00:00
core: make persistent workspaces always follow the config
instead of just staying after open, they will now be enforced on their respective monitors fixes #8769
This commit is contained in:
@@ -3024,3 +3024,46 @@ bool CCompositor::shouldChangePreferredImageDescription() {
|
|||||||
Debug::log(WARN, "FIXME: color management protocol is enabled and outputs changed, check preferred image description changes");
|
Debug::log(WARN, "FIXME: color management protocol is enabled and outputs changed, check preferred image description changes");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCompositor::ensurePersistentWorkspacesPresent(const std::vector<SWorkspaceRule>& rules) {
|
||||||
|
for (const auto& rule : rules) {
|
||||||
|
if (!rule.isPersistent)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const auto PMONITOR = getMonitorFromString(rule.monitor);
|
||||||
|
|
||||||
|
if (!PMONITOR) {
|
||||||
|
Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve monitor for {}, skipping", rule.monitor);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
WORKSPACEID id = rule.workspaceId;
|
||||||
|
std::string wsname = rule.workspaceName;
|
||||||
|
if (id == WORKSPACE_INVALID) {
|
||||||
|
const auto R = getWorkspaceIDNameFromString(rule.workspaceString);
|
||||||
|
id = R.id;
|
||||||
|
wsname = R.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id == WORKSPACE_INVALID) {
|
||||||
|
Debug::log(ERR, "ensurePersistentWorkspacesPresent: couldn't resolve id for workspace {}", rule.workspaceString);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (const auto PWORKSPACE = getWorkspaceByID(id); PWORKSPACE) {
|
||||||
|
if (PWORKSPACE->m_pMonitor == PMONITOR) {
|
||||||
|
Debug::log(LOG, "ensurePersistentWorkspacesPresent: workspace persistent {} already on {}", rule.workspaceString, PMONITOR->szName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Debug::log(LOG, "ensurePersistentWorkspacesPresent: workspace persistent {} not on {}, moving", rule.workspaceString, PMONITOR->szName);
|
||||||
|
moveWorkspaceToMonitor(PWORKSPACE, PMONITOR);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
createNewWorkspace(id, PMONITOR ? PMONITOR : m_pLastMonitor.lock(), wsname, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// cleanup old
|
||||||
|
sanityCheckWorkspaces();
|
||||||
|
}
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include <aquamarine/output/Output.hpp>
|
#include <aquamarine/output/Output.hpp>
|
||||||
|
|
||||||
class CWLSurfaceResource;
|
class CWLSurfaceResource;
|
||||||
|
struct SWorkspaceRule;
|
||||||
|
|
||||||
enum eManagersInitStage : uint8_t {
|
enum eManagersInitStage : uint8_t {
|
||||||
STAGE_PRIORITY = 0,
|
STAGE_PRIORITY = 0,
|
||||||
@@ -151,6 +152,7 @@ class CCompositor {
|
|||||||
void setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurface, wl_output_transform transform);
|
void setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurface, wl_output_transform transform);
|
||||||
void updateSuspendedStates();
|
void updateSuspendedStates();
|
||||||
void onNewMonitor(SP<Aquamarine::IOutput> output);
|
void onNewMonitor(SP<Aquamarine::IOutput> output);
|
||||||
|
void ensurePersistentWorkspacesPresent(const std::vector<SWorkspaceRule>& rules);
|
||||||
|
|
||||||
SImageDescription getPreferredImageDescription();
|
SImageDescription getPreferredImageDescription();
|
||||||
bool shouldChangePreferredImageDescription();
|
bool shouldChangePreferredImageDescription();
|
||||||
|
@@ -1034,6 +1034,10 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||||||
// update plugins
|
// update plugins
|
||||||
handlePluginLoads();
|
handlePluginLoads();
|
||||||
|
|
||||||
|
// update persistent workspaces
|
||||||
|
if (!isFirstLaunch)
|
||||||
|
ensurePersistentWorkspacesPresent();
|
||||||
|
|
||||||
EMIT_HOOK_EVENT("configReloaded", nullptr);
|
EMIT_HOOK_EVENT("configReloaded", nullptr);
|
||||||
if (g_pEventManager)
|
if (g_pEventManager)
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"configreloaded", ""});
|
g_pEventManager->postEvent(SHyprIPCEvent{"configreloaded", ""});
|
||||||
@@ -2830,3 +2834,7 @@ std::string SConfigOptionDescription::jsonify() const {
|
|||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigManager::ensurePersistentWorkspacesPresent() {
|
||||||
|
g_pCompositor->ensurePersistentWorkspacesPresent(m_vWorkspaceRules);
|
||||||
|
}
|
||||||
|
@@ -169,6 +169,7 @@ class CConfigManager {
|
|||||||
|
|
||||||
std::vector<SP<CWindowRule>> getMatchingRules(PHLWINDOW, bool dynamic = true, bool shadowExec = false);
|
std::vector<SP<CWindowRule>> getMatchingRules(PHLWINDOW, bool dynamic = true, bool shadowExec = false);
|
||||||
std::vector<SP<CLayerRule>> getMatchingRules(PHLLS);
|
std::vector<SP<CLayerRule>> getMatchingRules(PHLLS);
|
||||||
|
void ensurePersistentWorkspacesPresent();
|
||||||
|
|
||||||
const std::vector<SConfigOptionDescription>& getAllDescriptions();
|
const std::vector<SConfigOptionDescription>& getAllDescriptions();
|
||||||
|
|
||||||
|
@@ -51,6 +51,8 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
EMIT_HOOK_EVENT("preMonitorAdded", self.lock());
|
EMIT_HOOK_EVENT("preMonitorAdded", self.lock());
|
||||||
CScopeGuard x = {[]() { g_pCompositor->arrangeMonitors(); }};
|
CScopeGuard x = {[]() { g_pCompositor->arrangeMonitors(); }};
|
||||||
|
|
||||||
|
g_pEventLoopManager->doLater([] { g_pConfigManager->ensurePersistentWorkspacesPresent(); });
|
||||||
|
|
||||||
if (output->supportsExplicit) {
|
if (output->supportsExplicit) {
|
||||||
inTimeline = CSyncTimeline::create(output->getBackend()->drmFD());
|
inTimeline = CSyncTimeline::create(output->getBackend()->drmFD());
|
||||||
outTimeline = CSyncTimeline::create(output->getBackend()->drmFD());
|
outTimeline = CSyncTimeline::create(output->getBackend()->drmFD());
|
||||||
|
Reference in New Issue
Block a user