summaryrefslogtreecommitdiff
path: root/src/layout/algorithm/tiled
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-03-02 21:39:06 +0000
committerGitHub <noreply@github.com>2026-03-02 21:39:06 +0000
commitbe03497b82be332a124dd170e8741623791ef7c4 (patch)
tree06758f08e32a6647d43f70184be40fa1a1024074 /src/layout/algorithm/tiled
parentff20cbf89c68a87b12c0cd3453ac13d7c7197da5 (diff)
layout/algos: use binds:window_direction_monitor_fallback for moves (#13508)
ref https://github.com/hyprwm/Hyprland/discussions/13473
Diffstat (limited to 'src/layout/algorithm/tiled')
-rw-r--r--src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp9
-rw-r--r--src/layout/algorithm/tiled/master/MasterAlgorithm.cpp7
-rw-r--r--src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp5
-rw-r--r--src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp8
4 files changed, 25 insertions, 4 deletions
diff --git a/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp b/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp
index 1c8c43a7..17ddfe8a 100644
--- a/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/dwindle/DwindleAlgorithm.cpp
@@ -549,6 +549,8 @@ std::optional<Vector2D> CDwindleAlgorithm::predictSizeForNewTarget() {
}
void CDwindleAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool silent) {
+ static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
+
const auto PNODE = getNodeFromTarget(t);
const Vector2D originalPos = t->position().middle();
@@ -557,12 +559,15 @@ void CDwindleAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection di
const auto FOCAL_POINT = focalPointForDir(t, dir);
+ const auto PMONITORFOCAL = g_pCompositor->getMonitorFromVector(FOCAL_POINT.value_or(t->position().middle()));
+
+ if (PMONITORFOCAL != m_parent->space()->workspace()->m_monitor && !*PMONITORFALLBACK)
+ return; // noop
+
t->window()->setAnimationsToMove();
removeTarget(t);
- const auto PMONITORFOCAL = g_pCompositor->getMonitorFromVector(FOCAL_POINT.value_or(t->position().middle()));
-
if (PMONITORFOCAL != m_parent->space()->workspace()->m_monitor) {
// move with a focal point
diff --git a/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp b/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp
index 88540d20..f2914a46 100644
--- a/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/master/MasterAlgorithm.cpp
@@ -403,7 +403,9 @@ void CMasterAlgorithm::swapTargets(SP<ITarget> a, SP<ITarget> b) {
}
void CMasterAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool silent) {
- const auto PWINDOW2 = g_pCompositor->getWindowInDirection(t->window(), dir);
+ static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
+
+ const auto PWINDOW2 = g_pCompositor->getWindowInDirection(t->window(), dir);
if (!t->window())
return;
@@ -424,6 +426,9 @@ void CMasterAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection dir
t->window()->setAnimationsToMove();
if (t->window()->m_workspace != targetWs) {
+ if (!*PMONITORFALLBACK)
+ return; // noop
+
t->assignToSpace(targetWs->m_space, focalPointForDir(t, dir));
} else if (PWINDOW2) {
// if same monitor, switch windows
diff --git a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp
index 3551b370..fe92f27c 100644
--- a/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/monocle/MonocleAlgorithm.cpp
@@ -202,6 +202,11 @@ void CMonocleAlgorithm::swapTargets(SP<ITarget> a, SP<ITarget> b) {
}
void CMonocleAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool silent) {
+ static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
+
+ if (!*PMONITORFALLBACK)
+ return; // noop
+
// try to find a monitor in the specified direction, thats the logical thing
if (!t || !t->space() || !t->space()->workspace())
return;
diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
index 3b5dca4a..0c3bb1cc 100644
--- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
+++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
@@ -848,7 +848,9 @@ void CScrollingAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection
}
void CScrollingAlgorithm::moveTargetTo(SP<ITarget> t, Math::eDirection dir, bool silent) {
- const auto DATA = dataFor(t);
+ static auto PMONITORFALLBACK = CConfigValue<Hyprlang::INT>("binds:window_direction_monitor_fallback");
+
+ const auto DATA = dataFor(t);
if (!DATA)
return;
@@ -953,6 +955,10 @@ void CScrollingAlgorithm::moveTargetTo(SP<ITarget> t, Math::eDirection dir, bool
if (!commenceDir()) {
// dir wasn't commenced, move to a workspace if possible
// with the original dir
+
+ if (!*PMONITORFALLBACK)
+ return; // noop
+
const auto MONINDIR = g_pCompositor->getMonitorInDirection(m_parent->space()->workspace()->m_monitor.lock(), dir);
if (MONINDIR && MONINDIR != m_parent->space()->workspace()->m_monitor && MONINDIR->m_activeWorkspace) {
t->assignToSpace(MONINDIR->m_activeWorkspace->m_space, focalPointForDir(t, dir));