Added workspace windowrule

This commit is contained in:
vaxerski 2022-04-21 17:17:47 +02:00
parent 064e40d25f
commit 2b8b34d8db
3 changed files with 14 additions and 5 deletions

View File

@ -241,7 +241,8 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
&& RULE.find("move") != 0
&& RULE.find("size") != 0
&& RULE.find("pseudo") != 0
&& RULE.find("monitor") != 0) {
&& RULE.find("monitor") != 0
&& RULE.find("workspace") != 0) {
Debug::log(ERR, "Invalid rule found: %s", RULE.c_str());
parseError = "Invalid rule found: " + RULE;
return;

View File

@ -68,10 +68,18 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace;
Debug::log(LOG, "Rule monitor, applying to window %x -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
} catch (...) {
Debug::log(LOG, "Rule monitor failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
Debug::log(ERR, "Rule monitor, applying to window %x -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
} catch (std::exception& e) {
Debug::log(ERR, "Rule monitor failed, rule: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what());
}
} else if (r.szRule.find("workspace") == 0) {
// switch to workspace
g_pKeybindManager->m_mDispatchers["workspace"](r.szRule.substr(r.szRule.find_first_of(' ') + 1));
PWINDOW->m_iMonitorID = g_pCompositor->m_pLastMonitor->ID;
PWINDOW->m_iWorkspaceID = g_pCompositor->m_pLastMonitor->activeWorkspace;
Debug::log(LOG, "Rule workspace matched by window %x, %s applied.", PWINDOW, r.szValue.c_str());
} else if (r.szRule.find("float") == 0) {
PWINDOW->m_bIsFloating = true;
} else if (r.szRule.find("tile") == 0) {

View File

@ -161,7 +161,7 @@ void CKeybindManager::toggleActivePseudo(std::string args) {
g_pLayoutManager->getCurrentLayout()->recalculateWindow(ACTIVEWINDOW);
}
void CKeybindManager::changeworkspace(std::string args) {
void CKeybindManager::gichangeworkspace(std::string args) {
int workspaceToChangeTo = 0;
std::string workspaceName = "";