From f7c5048dff477bd86ec871d55576d53210110f94 Mon Sep 17 00:00:00 2001
From: Daniel Mueller <deso@posteo.net>
Date: Tue, 14 Nov 2017 21:06:42 -0800
Subject: [PATCH 07/14] Do not wrap around when switching outputs

When switching to another output i3 wraps around. For example, if we are
already focused on the right most output and issue a command to focus
the next output to the right it will actually start over with the left
most one.
This behavior is undesired. This patch adjusts the output changing logic
to no longer wrap around. If we reached the right most container and
issue a 'focus output right' command the focus will simply stay where it
is. The behavior when changing the output in another direction
(left/up/down) is adjusted in a similar way.
---
 src/output.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/output.c b/src/output.c
index a1d6aa..4c8d23 100644
--- a/src/output.c
+++ b/src/output.c
@@ -35,16 +35,16 @@ Output *get_output_from_string(Output *current_output, const char *output_str) {
         return get_output_for_con(focused);
     }
     if (strcasecmp(output_str, "left") == 0) {
-        return get_output_next_wrap(D_LEFT, current_output);
+        return get_output_next(D_LEFT, current_output, CLOSEST_OUTPUT);
     }
     if (strcasecmp(output_str, "right") == 0) {
-        return get_output_next_wrap(D_RIGHT, current_output);
+        return get_output_next(D_RIGHT, current_output, CLOSEST_OUTPUT);
     }
     if (strcasecmp(output_str, "up") == 0) {
-        return get_output_next_wrap(D_UP, current_output);
+        return get_output_next(D_UP, current_output, CLOSEST_OUTPUT);
     }
     if (strcasecmp(output_str, "down") == 0) {
-        return get_output_next_wrap(D_DOWN, current_output);
+        return get_output_next(D_DOWN, current_output, CLOSEST_OUTPUT);
     }
 
     return get_output_by_name(output_str, true);
-- 
2.52.0

