aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorD.B <thejan.2009@gmail.com>2016-10-07 07:32:57 +0200
committerD.B <thejan.2009@gmail.com>2016-10-07 08:12:14 +0200
commitd3f5ac8cbbdde88e5822c1d9dd20ce9cbde8cbbe (patch)
tree0bc3d10ca1e127f92c047adb85c4bba68d61471c /sway
parent7f558ce894934bd347140f5edd6419bf7d115c26 (diff)
downloadsway-d3f5ac8cbbdde88e5822c1d9dd20ce9cbde8cbbe.tar.xz
add force_focus_wrapping option
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/force_focus_wrapping.c12
-rw-r--r--sway/layout.c3
3 files changed, 16 insertions, 0 deletions
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[] = {
{ "focus", cmd_focus },
{ "focus_follows_mouse", cmd_focus_follows_mouse },
{ "font", cmd_font },
+ { "force_focus_wrapping", cmd_force_focus_wrapping },
{ "for_window", cmd_for_window },
{ "fullscreen", cmd_fullscreen },
{ "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 @@
+#include <string.h>
+#include "sway/commands.h"
+
+struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "force_focus_wrapping", EXPECTED_EQUAL_TO, 1))) {
+ return error;
+ }
+
+ config->force_focus_wrapping = !strcasecmp(argv[0], "yes");
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
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
} else {
wrap_candidate = parent->children->items[0];
}
+ if (config->force_focus_wrapping) {
+ return wrap_candidate;
+ }
}
} else {
return parent->children->items[desired];