Add hyprland patches
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
78
hosts/common/configs/user/gui/hyprland/auto-center.patch
Normal file
78
hosts/common/configs/user/gui/hyprland/auto-center.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
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 {
|
@@ -9,6 +9,17 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
hyprland = prev.hyprland.overrideAttrs (oldAttrs: {
|
||||
patches = oldAttrs.patches or [ ] ++ [
|
||||
./auto-center.patch
|
||||
./maxwidth-resolution-mode.patch
|
||||
];
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
programs.hyprland.enable = true;
|
||||
|
||||
home-manager.users.${user} = {
|
||||
@@ -106,6 +117,7 @@
|
||||
general.layout = "master";
|
||||
|
||||
master = {
|
||||
orientation = "center";
|
||||
slave_count_for_center_master = 0;
|
||||
mfact = 0.5;
|
||||
};
|
||||
|
@@ -0,0 +1,44 @@
|
||||
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);
|
@@ -392,7 +392,7 @@ in
|
||||
|
||||
size = mkOption {
|
||||
type = ints.positive;
|
||||
default = 32;
|
||||
default = 24;
|
||||
description = "The cursor size.";
|
||||
};
|
||||
};
|
||||
|
@@ -6,13 +6,27 @@
|
||||
|
||||
home-manager.sharedModules = [
|
||||
{
|
||||
wayland.windowManager.hyprland.settings.monitor = [
|
||||
"eDP-1, 2560x1600@165, 0x0, 1.25"
|
||||
];
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
monitor = [
|
||||
"eDP-1, preferred, 0x0, 1.25"
|
||||
", maxwidth, auto-center-up, 1"
|
||||
];
|
||||
|
||||
workspace = [
|
||||
"1, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"2, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"3, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"4, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"5, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"6, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"7, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"8, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"9, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"10, monitor:eDP-1, layoutopt:orientation:left"
|
||||
];
|
||||
};
|
||||
|
||||
programs.vscode.profiles.default.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
|
||||
|
||||
theme.cursor.size = 24;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@@ -6,37 +6,25 @@
|
||||
{
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
monitor = [
|
||||
"desc:Sharp Corporation, 1920x1200@60, 0x0, 1"
|
||||
"desc:Dell Inc. DELL U3425WE, 3440x1440@60, -760x-1440, 1"
|
||||
"eDP-1, preferred, 0x0, 1"
|
||||
", maxwidth, auto-center-up, 1"
|
||||
];
|
||||
|
||||
workspace = [
|
||||
"1, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"2, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"3, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"4, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"5, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"6, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"7, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"8, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"9, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"10, monitor:desc:Sharp Corporation, layoutopt:orientation:left"
|
||||
"11, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"12, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"13, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"14, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"15, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"16, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"17, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"18, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"19, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"20, monitor:desc:Dell Inc. DELL U3425WE, layoutopt:orientation:left"
|
||||
"1, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"2, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"3, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"4, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"5, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"6, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"7, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"8, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"9, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"10, monitor:eDP-1, layoutopt:orientation:left"
|
||||
];
|
||||
};
|
||||
|
||||
programs.vscode.profiles.default.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
|
||||
|
||||
theme.cursor.size = 24;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
@@ -8,8 +8,8 @@
|
||||
{
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
monitor = [
|
||||
"eDP-1, 2560x1600@240, 0x0, 1.25"
|
||||
"HDMI-A-2, 5120x1440@144, -1536x-1440, 1"
|
||||
"eDP-1, preferred, 0x0, 1.25"
|
||||
", maxwidth, auto-center-up, 1"
|
||||
];
|
||||
|
||||
workspace = [
|
||||
@@ -23,22 +23,10 @@
|
||||
"8, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"9, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"10, monitor:eDP-1, layoutopt:orientation:left"
|
||||
"11, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"12, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"13, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"14, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"15, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"16, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"17, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"18, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"19, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
"20, monitor:HDMI-A-2, layoutopt:orientation:center"
|
||||
];
|
||||
};
|
||||
|
||||
programs.vscode.profiles.default.userSettings."window.zoomLevel" = (1.25 - 1) / 0.2;
|
||||
|
||||
theme.cursor.size = 24;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user