summaryrefslogtreecommitdiff
path: root/src/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'src/desktop')
-rw-r--r--src/desktop/Workspace.cpp12
-rw-r--r--src/desktop/Workspace.hpp6
2 files changed, 11 insertions, 7 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index b730c9ab..7a836b3b 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -2,17 +2,18 @@
#include "../Compositor.hpp"
#include "../config/ConfigValue.hpp"
-PHLWORKSPACE CWorkspace::create(int id, int monitorID, std::string name, bool special) {
- PHLWORKSPACE workspace = makeShared<CWorkspace>(id, monitorID, name, special);
+PHLWORKSPACE CWorkspace::create(int id, int monitorID, std::string name, bool special, bool isEmtpy) {
+ PHLWORKSPACE workspace = makeShared<CWorkspace>(id, monitorID, name, special, isEmtpy);
workspace->init(workspace);
return workspace;
}
-CWorkspace::CWorkspace(int id, int monitorID, std::string name, bool special) {
+CWorkspace::CWorkspace(int id, int monitorID, std::string name, bool special, bool isEmtpy) {
m_iMonitorID = monitorID;
m_iID = id;
m_szName = name;
m_bIsSpecialWorkspace = special;
+ m_bWasCreatedEmtpy = isEmtpy;
}
void CWorkspace::init(PHLWORKSPACE self) {
@@ -44,8 +45,9 @@ void CWorkspace::init(PHLWORKSPACE self) {
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(self);
m_bPersistent = WORKSPACERULE.isPersistent;
- if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
- g_pKeybindManager->spawn(*cmd);
+ if (self->m_bWasCreatedEmtpy)
+ if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
+ g_pKeybindManager->spawn(*cmd);
g_pEventManager->postEvent({"createworkspace", m_szName});
g_pEventManager->postEvent({"createworkspacev2", std::format("{},{}", m_iID, m_szName)});
diff --git a/src/desktop/Workspace.hpp b/src/desktop/Workspace.hpp
index 3fae3dfc..17431215 100644
--- a/src/desktop/Workspace.hpp
+++ b/src/desktop/Workspace.hpp
@@ -15,9 +15,9 @@ class CWindow;
class CWorkspace {
public:
- static PHLWORKSPACE create(int id, int monitorID, std::string name, bool special = false);
+ static PHLWORKSPACE create(int id, int monitorID, std::string name, bool special = false, bool isEmtpy = true);
// use create() don't use this
- CWorkspace(int id, int monitorID, std::string name, bool special = false);
+ CWorkspace(int id, int monitorID, std::string name, bool special = false, bool isEmpty = true);
~CWorkspace();
// Workspaces ID-based have IDs > 0
@@ -58,6 +58,8 @@ class CWorkspace {
// last monitor (used on reconnect)
std::string m_szLastMonitor = "";
+ bool m_bWasCreatedEmtpy = true;
+
bool m_bPersistent = false;
// Inert: destroyed and invalid. If this is true, release the ptr you have.