@@ -1,78 +0,0 @@
|
||||
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
|
||||
index c6593923..b4d3aaea 100644
|
||||
--- a/src/Compositor.cpp
|
||||
+++ b/src/Compositor.cpp
|
||||
@@ -2890,6 +2890,30 @@ void CCompositor::arrangeMonitors() {
|
||||
case eAutoDirs::DIR_AUTO_LEFT: newPosition.x = maxXOffsetLeft - m->m_size.x; break;
|
||||
case eAutoDirs::DIR_AUTO_RIGHT:
|
||||
case eAutoDirs::DIR_AUTO_NONE: newPosition.x = maxXOffsetRight; break;
|
||||
+ case eAutoDirs::DIR_AUTO_CENTER_UP: {
|
||||
+ int width = maxXOffsetRight - maxXOffsetLeft;
|
||||
+ newPosition.y = maxYOffsetUp - m->m_size.y;
|
||||
+ newPosition.x = maxXOffsetLeft + (width - m->m_size.x) / 2;
|
||||
+ break;
|
||||
+ }
|
||||
+ case eAutoDirs::DIR_AUTO_CENTER_DOWN: {
|
||||
+ int width = maxXOffsetRight - maxXOffsetLeft;
|
||||
+ newPosition.y = maxYOffsetDown;
|
||||
+ newPosition.x = maxXOffsetLeft + (width - m->m_size.x) / 2;
|
||||
+ break;
|
||||
+ }
|
||||
+ case eAutoDirs::DIR_AUTO_CENTER_LEFT: {
|
||||
+ int height = maxYOffsetDown - maxYOffsetUp;
|
||||
+ newPosition.x = maxXOffsetLeft - m->m_size.x;
|
||||
+ newPosition.y = maxYOffsetUp + (height - m->m_size.y) / 2;
|
||||
+ break;
|
||||
+ }
|
||||
+ case eAutoDirs::DIR_AUTO_CENTER_RIGHT: {
|
||||
+ int height = maxYOffsetDown - maxYOffsetUp;
|
||||
+ newPosition.x = maxXOffsetRight;
|
||||
+ newPosition.y = maxYOffsetUp + (height - m->m_size.y) / 2;
|
||||
+ break;
|
||||
+ }
|
||||
default: UNREACHABLE();
|
||||
}
|
||||
Debug::log(LOG, "arrangeMonitors: {} auto {:j}", m->m_name, m->m_position);
|
||||
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
|
||||
index f5f0bed3..3c988a53 100644
|
||||
--- a/src/config/ConfigManager.cpp
|
||||
+++ b/src/config/ConfigManager.cpp
|
||||
@@ -2046,10 +2046,20 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
|
||||
newrule.autoDir = eAutoDirs::DIR_AUTO_UP;
|
||||
else if (ARGS[2] == "auto-down")
|
||||
newrule.autoDir = eAutoDirs::DIR_AUTO_DOWN;
|
||||
+ else if (ARGS[2] == "auto-center-right")
|
||||
+ newrule.autoDir = eAutoDirs::DIR_AUTO_CENTER_RIGHT;
|
||||
+ else if (ARGS[2] == "auto-center-left")
|
||||
+ newrule.autoDir = eAutoDirs::DIR_AUTO_CENTER_LEFT;
|
||||
+ else if (ARGS[2] == "auto-center-up")
|
||||
+ newrule.autoDir = eAutoDirs::DIR_AUTO_CENTER_UP;
|
||||
+ else if (ARGS[2] == "auto-center-down")
|
||||
+ newrule.autoDir = eAutoDirs::DIR_AUTO_CENTER_DOWN;
|
||||
else {
|
||||
Debug::log(WARN,
|
||||
"Invalid auto direction. Valid options are 'auto',"
|
||||
- "'auto-up', 'auto-down', 'auto-left', and 'auto-right'.");
|
||||
+ "'auto-up', 'auto-down', 'auto-left', 'auto-right',"
|
||||
+ "'auto-center-up', 'auto-center-down',"
|
||||
+ "'auto-center-left', and 'auto-center-right'.");
|
||||
error += "invalid auto direction ";
|
||||
}
|
||||
} else {
|
||||
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
|
||||
index 31777b0c..019a5547 100644
|
||||
--- a/src/helpers/Monitor.hpp
|
||||
+++ b/src/helpers/Monitor.hpp
|
||||
@@ -25,7 +25,11 @@ enum eAutoDirs : uint8_t {
|
||||
DIR_AUTO_UP,
|
||||
DIR_AUTO_DOWN,
|
||||
DIR_AUTO_LEFT,
|
||||
- DIR_AUTO_RIGHT
|
||||
+ DIR_AUTO_RIGHT,
|
||||
+ DIR_AUTO_CENTER_UP,
|
||||
+ DIR_AUTO_CENTER_DOWN,
|
||||
+ DIR_AUTO_CENTER_LEFT,
|
||||
+ DIR_AUTO_CENTER_RIGHT
|
||||
};
|
||||
|
||||
enum eCMType : uint8_t {
|
@@ -10,8 +10,7 @@
|
||||
(final: prev: {
|
||||
hyprland = prev.hyprland.overrideAttrs (oldAttrs: {
|
||||
patches = oldAttrs.patches or [ ] ++ [
|
||||
./auto-center.patch
|
||||
./maxwidth-resolution-mode.patch
|
||||
./fix-maxwidth-resolution-mode.patch
|
||||
];
|
||||
});
|
||||
})
|
||||
|
@@ -0,0 +1,13 @@
|
||||
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
|
||||
index 635c7977..80093c0d 100644
|
||||
--- a/src/config/ConfigManager.cpp
|
||||
+++ b/src/config/ConfigManager.cpp
|
||||
@@ -2091,6 +2091,8 @@ bool CMonitorRuleParser::parseMode(const std::string& value) {
|
||||
m_rule.resolution = Vector2D(-1, -1);
|
||||
else if (value.starts_with("highres"))
|
||||
m_rule.resolution = Vector2D(-1, -2);
|
||||
+ else if (value.starts_with("maxwidth"))
|
||||
+ m_rule.resolution = Vector2D(-1, -3);
|
||||
else if (parseModeLine(value, m_rule.drmMode)) {
|
||||
m_rule.resolution = Vector2D(m_rule.drmMode.hdisplay, m_rule.drmMode.vdisplay);
|
||||
m_rule.refreshRate = float(m_rule.drmMode.vrefresh) / 1000;
|
@@ -1,44 +0,0 @@
|
||||
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
|
||||
index f5f0bed3..cfe39b70 100644
|
||||
--- a/src/config/ConfigManager.cpp
|
||||
+++ b/src/config/ConfigManager.cpp
|
||||
@@ -2013,6 +2013,8 @@ std::optional<std::string> CConfigManager::handleMonitor(const std::string& comm
|
||||
newrule.resolution = Vector2D(-1, -1);
|
||||
} else if (ARGS[1].starts_with("highres")) {
|
||||
newrule.resolution = Vector2D(-1, -2);
|
||||
+ } else if (ARGS[1].starts_with("maxwidth")) {
|
||||
+ newrule.resolution = Vector2D(-1, -3);
|
||||
} else if (parseModeLine(ARGS[1], newrule.drmMode)) {
|
||||
newrule.resolution = Vector2D(newrule.drmMode.hdisplay, newrule.drmMode.vdisplay);
|
||||
newrule.refreshRate = float(newrule.drmMode.vrefresh) / 1000;
|
||||
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
|
||||
index 4dc0942d..72a221f5 100644
|
||||
--- a/src/helpers/Monitor.cpp
|
||||
+++ b/src/helpers/Monitor.cpp
|
||||
@@ -515,7 +515,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
|
||||
} else if (RULE->resolution == Vector2D(-1, -2)) {
|
||||
requestedStr = "highres";
|
||||
|
||||
- // sort prioritizing resultion 1st and refresh rate 2nd, then add best 3
|
||||
+ // sort prioritizing resolution 1st and refresh rate 2nd, then add best 3
|
||||
addBest3Modes([](auto const& a, auto const& b) {
|
||||
if (a->pixelSize.x > b->pixelSize.x && a->pixelSize.y > b->pixelSize.y)
|
||||
return true;
|
||||
@@ -524,6 +524,17 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
+ } else if (RULE->resolution == Vector2D(-1, -3)) {
|
||||
+ requestedStr = "maxwidth";
|
||||
+
|
||||
+ // sort prioritizing widest resolution 1st and refresh rate 2nd, then add best 3
|
||||
+ addBest3Modes([](auto const& a, auto const& b) {
|
||||
+ if (a->pixelSize.x > b->pixelSize.x)
|
||||
+ return true;
|
||||
+ if (a->pixelSize.x == b->pixelSize.x && std::round(a->refreshRate) > std::round(b->refreshRate))
|
||||
+ return true;
|
||||
+ return false;
|
||||
+ });
|
||||
} else if (RULE->resolution != Vector2D()) {
|
||||
// user requested mode
|
||||
requestedStr = std::format("{:X0}@{:.2f}Hz", RULE->resolution, RULE->refreshRate);
|
Reference in New Issue
Block a user