mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 03:05:58 +01:00
add maxsize window rule
This commit is contained in:
parent
edeb759bb1
commit
dca30815b0
2 changed files with 16 additions and 0 deletions
|
@ -722,6 +722,7 @@ bool windowRuleValid(const std::string& RULE) {
|
||||||
&& RULE.find("move") != 0
|
&& RULE.find("move") != 0
|
||||||
&& RULE.find("size") != 0
|
&& RULE.find("size") != 0
|
||||||
&& RULE.find("minsize") != 0
|
&& RULE.find("minsize") != 0
|
||||||
|
&& RULE.find("maxsize") != 0
|
||||||
&& RULE.find("pseudo") != 0
|
&& RULE.find("pseudo") != 0
|
||||||
&& RULE.find("monitor") != 0
|
&& RULE.find("monitor") != 0
|
||||||
&& RULE != "nofocus"
|
&& RULE != "nofocus"
|
||||||
|
|
|
@ -269,6 +269,21 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
Debug::log(LOG, "Rule minsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
Debug::log(LOG, "Rule minsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
||||||
}
|
}
|
||||||
|
} else if (r.szRule.find("maxsize") == 0) {
|
||||||
|
try {
|
||||||
|
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
||||||
|
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" "));
|
||||||
|
const auto SIZEYSTR = VALUE.substr(VALUE.find(" ") + 1);
|
||||||
|
|
||||||
|
const auto SIZE = Vector2D(std::min((double)std::stoll(SIZEXSTR), PWINDOW->m_vRealSize.goalv().x), std::min((double)std::stoll(SIZEYSTR), PWINDOW->m_vRealSize.goalv().y));
|
||||||
|
|
||||||
|
PWINDOW->m_vRealSize = SIZE;
|
||||||
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||||
|
|
||||||
|
PWINDOW->setHidden(false);
|
||||||
|
} catch (...) {
|
||||||
|
Debug::log(LOG, "Rule maxsize failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
|
||||||
|
}
|
||||||
} else if (r.szRule.find("move") == 0) {
|
} else if (r.szRule.find("move") == 0) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(" ") + 1);
|
||||||
|
|
Loading…
Reference in a new issue