summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar D.B <thejan.2009@gmail.com>2016-10-07 07:32:57 +0200
committerLibravatar D.B <thejan.2009@gmail.com>2016-10-07 08:12:14 +0200
commitd3f5ac8cbbdde88e5822c1d9dd20ce9cbde8cbbe (patch)
tree0bc3d10ca1e127f92c047adb85c4bba68d61471c
parentwrap container in direction (if possible) (diff)
downloadsway-d3f5ac8cbbdde88e5822c1d9dd20ce9cbde8cbbe.tar.gz
sway-d3f5ac8cbbdde88e5822c1d9dd20ce9cbde8cbbe.tar.zst
sway-d3f5ac8cbbdde88e5822c1d9dd20ce9cbde8cbbe.zip
add force_focus_wrapping option
-rw-r--r--include/sway/commands.h1
-rw-r--r--include/sway/config.h1
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/force_focus_wrapping.c12
-rw-r--r--sway/layout.c3
5 files changed, 18 insertions, 0 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index f646c412..fe67c58c 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -106,6 +106,7 @@ sway_cmd cmd_focus;
106sway_cmd cmd_focus_follows_mouse; 106sway_cmd cmd_focus_follows_mouse;
107sway_cmd cmd_font; 107sway_cmd cmd_font;
108sway_cmd cmd_for_window; 108sway_cmd cmd_for_window;
109sway_cmd cmd_force_focus_wrapping;
109sway_cmd cmd_fullscreen; 110sway_cmd cmd_fullscreen;
110sway_cmd cmd_gaps; 111sway_cmd cmd_gaps;
111sway_cmd cmd_hide_edge_borders; 112sway_cmd cmd_hide_edge_borders;
diff --git a/include/sway/config.h b/include/sway/config.h
index 56deaf01..b29fe6c5 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -211,6 +211,7 @@ struct sway_config {
211 // Flags 211 // Flags
212 bool focus_follows_mouse; 212 bool focus_follows_mouse;
213 bool mouse_warping; 213 bool mouse_warping;
214 bool force_focus_wrapping;
214 bool active; 215 bool active;
215 bool failed; 216 bool failed;
216 bool reloading; 217 bool reloading;
diff --git a/sway/commands.c b/sway/commands.c
index 317122cd..d93f6591 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -171,6 +171,7 @@ static struct cmd_handler handlers[] = {
171 { "focus", cmd_focus }, 171 { "focus", cmd_focus },
172 { "focus_follows_mouse", cmd_focus_follows_mouse }, 172 { "focus_follows_mouse", cmd_focus_follows_mouse },
173 { "font", cmd_font }, 173 { "font", cmd_font },
174 { "force_focus_wrapping", cmd_force_focus_wrapping },
174 { "for_window", cmd_for_window }, 175 { "for_window", cmd_for_window },
175 { "fullscreen", cmd_fullscreen }, 176 { "fullscreen", cmd_fullscreen },
176 { "gaps", cmd_gaps }, 177 { "gaps", cmd_gaps },
diff --git a/sway/commands/force_focus_wrapping.c b/sway/commands/force_focus_wrapping.c
new file mode 100644
index 00000000..23019cd3
--- /dev/null
+++ b/sway/commands/force_focus_wrapping.c
@@ -0,0 +1,12 @@
1#include <string.h>
2#include "sway/commands.h"
3
4struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) {
5 struct cmd_results *error = NULL;
6 if ((error = checkarg(argc, "force_focus_wrapping", EXPECTED_EQUAL_TO, 1))) {
7 return error;
8 }
9
10 config->force_focus_wrapping = !strcasecmp(argv[0], "yes");
11 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
12}
diff --git a/sway/layout.c b/sway/layout.c
index f10e21bd..a7206e9a 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -1123,6 +1123,9 @@ swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_directio
1123 } else { 1123 } else {
1124 wrap_candidate = parent->children->items[0]; 1124 wrap_candidate = parent->children->items[0];
1125 } 1125 }
1126 if (config->force_focus_wrapping) {
1127 return wrap_candidate;
1128 }
1126 } 1129 }
1127 } else { 1130 } else {
1128 return parent->children->items[desired]; 1131 return parent->children->items[desired];