aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar lbonn <bonnans.l@gmail.com>2019-10-16 20:27:19 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2019-10-17 13:48:52 +0300
commit3ee3a9ef60c6259720564bbedb0c74d545d2ec53 (patch)
tree186eb0a0abf72e20fda497f1827c7fa717056d5c
parentxwayland.c handle_map(): NULL out xsurface->data() to prevent crashing. (diff)
downloadsway-3ee3a9ef60c6259720564bbedb0c74d545d2ec53.tar.gz
sway-3ee3a9ef60c6259720564bbedb0c74d545d2ec53.tar.zst
sway-3ee3a9ef60c6259720564bbedb0c74d545d2ec53.zip
focus: support focus_wrapping workspace
Following i3 support: https://github.com/i3/i3/pull/3407
-rw-r--r--include/sway/config.h3
-rw-r--r--sway/commands/focus.c3
-rw-r--r--sway/commands/focus_wrapping.c2
-rw-r--r--sway/sway.5.scd6
4 files changed, 10 insertions, 4 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index 0031db42..632027ea 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -409,7 +409,8 @@ enum focus_follows_mouse_mode {
409enum focus_wrapping_mode { 409enum focus_wrapping_mode {
410 WRAP_NO, 410 WRAP_NO,
411 WRAP_YES, 411 WRAP_YES,
412 WRAP_FORCE 412 WRAP_FORCE,
413 WRAP_WORKSPACE
413}; 414};
414 415
415enum mouse_warping_mode { 416enum mouse_warping_mode {
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 8baa616d..93d1effe 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -160,7 +160,8 @@ static struct sway_node *node_get_in_direction_tiling(
160 // Check a different output 160 // Check a different output
161 struct sway_output *output = container->workspace->output; 161 struct sway_output *output = container->workspace->output;
162 struct sway_output *new_output = output_get_in_direction(output, dir); 162 struct sway_output *new_output = output_get_in_direction(output, dir);
163 if (new_output) { 163 if ((config->focus_wrapping != WRAP_WORKSPACE ||
164 container->node.type == N_WORKSPACE) && new_output) {
164 return get_node_in_output_direction(new_output, dir); 165 return get_node_in_output_direction(new_output, dir);
165 } 166 }
166 167
diff --git a/sway/commands/focus_wrapping.c b/sway/commands/focus_wrapping.c
index 3a74a3ea..d3901cb8 100644
--- a/sway/commands/focus_wrapping.c
+++ b/sway/commands/focus_wrapping.c
@@ -11,6 +11,8 @@ struct cmd_results *cmd_focus_wrapping(int argc, char **argv) {
11 11
12 if (strcasecmp(argv[0], "force") == 0) { 12 if (strcasecmp(argv[0], "force") == 0) {
13 config->focus_wrapping = WRAP_FORCE; 13 config->focus_wrapping = WRAP_FORCE;
14 } else if (strcasecmp(argv[0], "workspace") == 0) {
15 config->focus_wrapping = WRAP_WORKSPACE;
14 } else if (parse_boolean(argv[0], config->focus_wrapping == WRAP_YES)) { 16 } else if (parse_boolean(argv[0], config->focus_wrapping == WRAP_YES)) {
15 config->focus_wrapping = WRAP_YES; 17 config->focus_wrapping = WRAP_YES;
16 } else { 18 } else {
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index 7c73a255..63b5465a 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -551,14 +551,16 @@ The default colors are:
551 If set to _smart_, the window will become focused only if it is already 551 If set to _smart_, the window will become focused only if it is already
552 visible, otherwise the urgent state will be set. Default is _smart_. 552 visible, otherwise the urgent state will be set. Default is _smart_.
553 553
554*focus_wrapping* yes|no|force 554*focus_wrapping* yes|no|force|workspace
555 This option determines what to do when attempting to focus over the edge 555 This option determines what to do when attempting to focus over the edge
556 of a container. If set to _no_, the focused container will retain focus, 556 of a container. If set to _no_, the focused container will retain focus,
557 if there are no other containers in the direction. If set to _yes_, focus 557 if there are no other containers in the direction. If set to _yes_, focus
558 will be wrapped to the opposite edge of the container, if there are no 558 will be wrapped to the opposite edge of the container, if there are no
559 other containers in the direction. If set to _force_, focus will be wrapped 559 other containers in the direction. If set to _force_, focus will be wrapped
560 to the opposite edge of the container, even if there are other containers 560 to the opposite edge of the container, even if there are other containers
561 in the direction. Default is _yes_. 561 in the direction. If set to _workspace_, focus will wrap like in the _yes_
562 case and additionally wrap when moving outside of workspaces boundaries.
563 Default is _yes_.
562 564
563*font* [pango:]<font> 565*font* [pango:]<font>
564 Sets font to use for the title bars. To enable support for pango markup, 566 Sets font to use for the title bars. To enable support for pango markup,