mirror of
https://github.com/hyprwm/Hypr.git
synced 2024-11-08 00:45:58 +01:00
Added fullscreen and workspace rules
This commit is contained in:
parent
dd1b2a7a4e
commit
894a9b0e3e
2 changed files with 48 additions and 0 deletions
|
@ -242,6 +242,8 @@ void handleWindowRule(const std::string& command, const std::string& value) {
|
|||
&& RULE.find("size") != 0
|
||||
&& RULE.find("nointerventions") != 0
|
||||
&& RULE.find("pseudo") != 0
|
||||
&& RULE.find("fullscreen") != 0
|
||||
&& RULE.find("workspace") != 0
|
||||
&& RULE.find("monitor") != 0) {
|
||||
Debug::log(ERR, "Invalid rule found: " + RULE);
|
||||
ConfigManager::parseError = "Invalid rule found: " + RULE;
|
||||
|
|
|
@ -217,6 +217,23 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
|
|||
if (rule.szRule.find("pseudo") == 0) {
|
||||
PWINDOWINARR->setIsPseudotiled(true);
|
||||
}
|
||||
|
||||
if (rule.szRule.find("fullscreen") == 0) {
|
||||
PWINDOWINARR->setFullscreen(true);
|
||||
}
|
||||
|
||||
if (rule.szRule.find("workspace") == 0) {
|
||||
try {
|
||||
const auto WORKSPACE = stoi(rule.szRule.substr(rule.szRule.find(" ") + 1));
|
||||
|
||||
Debug::log(LOG, "Rule workspace, applying to window " + std::to_string(windowID));
|
||||
|
||||
g_pWindowManager->changeWorkspaceByID(WORKSPACE);
|
||||
forcemonitor = g_pWindowManager->getWorkspaceByID(WORKSPACE)->getMonitor();
|
||||
} catch (...) {
|
||||
Debug::log(LOG, "Rule workspace failed, rule: " + rule.szRule + "=" + rule.szValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto CURRENTSCREEN = forcemonitor != -1 ? forcemonitor : PMONITOR->ID;
|
||||
|
@ -399,6 +416,12 @@ CWindow* Events::remapFloatingWindow(int windowID, int forcemonitor) {
|
|||
PWINDOWINARR->setConstructed(true);
|
||||
PWINDOWINARR->setFirstOpen(false);
|
||||
|
||||
// Fullscreen rule
|
||||
if (PWINDOWINARR->getFullscreen()) {
|
||||
PWINDOWINARR->setFullscreen(false);
|
||||
g_pWindowManager->toggleWindowFullscrenn(PWINDOWINARR->getDrawable());
|
||||
}
|
||||
|
||||
return PWINDOWINARR;
|
||||
}
|
||||
|
||||
|
@ -448,6 +471,23 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
|
|||
if (rule.szRule.find("pseudo") == 0) {
|
||||
PWINDOWINARR->setIsPseudotiled(true);
|
||||
}
|
||||
|
||||
if (rule.szRule.find("fullscreen") == 0) {
|
||||
PWINDOWINARR->setFullscreen(true);
|
||||
}
|
||||
|
||||
if (rule.szRule.find("workspace") == 0) {
|
||||
try {
|
||||
const auto WORKSPACE = stoi(rule.szRule.substr(rule.szRule.find(" ") + 1));
|
||||
|
||||
Debug::log(LOG, "Rule workspace, applying to window " + std::to_string(windowID));
|
||||
|
||||
g_pWindowManager->changeWorkspaceByID(WORKSPACE);
|
||||
forcemonitor = g_pWindowManager->getWorkspaceByID(WORKSPACE)->getMonitor();
|
||||
} catch (...) {
|
||||
Debug::log(LOG, "Rule workspace failed, rule: " + rule.szRule + "=" + rule.szValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow) && forcemonitor == -1 && PMONITOR->ID != g_pWindowManager->getWindowFromDrawable(g_pWindowManager->LastWindow)->getMonitor()) {
|
||||
|
@ -579,6 +619,12 @@ CWindow* Events::remapWindow(int windowID, bool wasfloating, int forcemonitor) {
|
|||
PWINDOWINARR->setConstructed(true);
|
||||
PWINDOWINARR->setFirstOpen(false);
|
||||
|
||||
// Fullscreen rule
|
||||
if (PWINDOWINARR->getFullscreen()) {
|
||||
PWINDOWINARR->setFullscreen(false);
|
||||
g_pWindowManager->toggleWindowFullscrenn(PWINDOWINARR->getDrawable());
|
||||
}
|
||||
|
||||
return PWINDOWINARR;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue