summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-28 11:09:46 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-28 11:09:46 -0400
commitc81d0ef1e8922ad34d431e5dae430b90b0b21d7b (patch)
treed26eaaeb6eff22539746a29fefb1e934943b578a
parentMerge pull request #2060 from RedSoxFan/focus-wrapping (diff)
downloadsway-c81d0ef1e8922ad34d431e5dae430b90b0b21d7b.tar.gz
sway-c81d0ef1e8922ad34d431e5dae430b90b0b21d7b.tar.zst
sway-c81d0ef1e8922ad34d431e5dae430b90b0b21d7b.zip
Support i3's legacy force_focus_wrapping command
-rw-r--r--include/sway/commands.h1
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/force_focus_wrapping.c22
-rw-r--r--sway/meson.build1
-rw-r--r--sway/sway.5.scd6
5 files changed, 31 insertions, 0 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index 87a8c23a..b2255c4b 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -109,6 +109,7 @@ sway_cmd cmd_focus_follows_mouse;
109sway_cmd cmd_focus_wrapping; 109sway_cmd cmd_focus_wrapping;
110sway_cmd cmd_font; 110sway_cmd cmd_font;
111sway_cmd cmd_for_window; 111sway_cmd cmd_for_window;
112sway_cmd cmd_force_focus_wrapping;
112sway_cmd cmd_fullscreen; 113sway_cmd cmd_fullscreen;
113sway_cmd cmd_gaps; 114sway_cmd cmd_gaps;
114sway_cmd cmd_hide_edge_borders; 115sway_cmd cmd_hide_edge_borders;
diff --git a/sway/commands.c b/sway/commands.c
index be16a4b4..b55ea58c 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -109,6 +109,7 @@ static struct cmd_handler handlers[] = {
109 { "focus_wrapping", cmd_focus_wrapping }, 109 { "focus_wrapping", cmd_focus_wrapping },
110 { "font", cmd_font }, 110 { "font", cmd_font },
111 { "for_window", cmd_for_window }, 111 { "for_window", cmd_for_window },
112 { "force_focus_wrapping", cmd_force_focus_wrapping },
112 { "fullscreen", cmd_fullscreen }, 113 { "fullscreen", cmd_fullscreen },
113 { "hide_edge_borders", cmd_hide_edge_borders }, 114 { "hide_edge_borders", cmd_hide_edge_borders },
114 { "include", cmd_include }, 115 { "include", cmd_include },
diff --git a/sway/commands/force_focus_wrapping.c b/sway/commands/force_focus_wrapping.c
new file mode 100644
index 00000000..bc1d067f
--- /dev/null
+++ b/sway/commands/force_focus_wrapping.c
@@ -0,0 +1,22 @@
1#include <strings.h>
2#include "sway/commands.h"
3#include "sway/config.h"
4
5struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) {
6 struct cmd_results *error =
7 checkarg(argc, "force_focus_wrapping", EXPECTED_EQUAL_TO, 1);
8 if (error) {
9 return error;
10 }
11
12 if (strcasecmp(argv[0], "no") == 0) {
13 config->focus_wrapping = WRAP_YES;
14 } else if (strcasecmp(argv[0], "yes") == 0) {
15 config->focus_wrapping = WRAP_FORCE;
16 } else {
17 return cmd_results_new(CMD_INVALID, "force_focus_wrapping",
18 "Expected 'force_focus_wrapping yes|no'");
19 }
20
21 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
22}
diff --git a/sway/meson.build b/sway/meson.build
index 76c312ba..e5878b9e 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -41,6 +41,7 @@ sway_sources = files(
41 'commands/focus_wrapping.c', 41 'commands/focus_wrapping.c',
42 'commands/font.c', 42 'commands/font.c',
43 'commands/for_window.c', 43 'commands/for_window.c',
44 'commands/force_focus_wrapping.c',
44 'commands/fullscreen.c', 45 'commands/fullscreen.c',
45 'commands/hide_edge_borders.c', 46 'commands/hide_edge_borders.c',
46 'commands/kill.c', 47 'commands/kill.c',
diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index 10990fc4..5ce6bf06 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -344,6 +344,12 @@ The default colors are:
344 Whenever a window that matches _criteria_ appears, run list of commands. 344 Whenever a window that matches _criteria_ appears, run list of commands.
345 See *CRITERIA* for more details. 345 See *CRITERIA* for more details.
346 346
347*force\_focus\_wrapping* yes|no
348 This option is a wrapper to support i3's legacy syntax. _no_ is equivalent
349 to _focus\_wrapping yes_ and _yes_ is equivalent to
350 _focus\_wrapping force_. This is only available for convenience. Please
351 use _focus\_wrapping_ instead when possible.
352
347*gaps* edge\_gaps on|off|toggle 353*gaps* edge\_gaps on|off|toggle
348 When _on_, gaps will be added between windows and workspace edges if the 354 When _on_, gaps will be added between windows and workspace edges if the
349 inner gap is nonzero. When _off_, gaps will only be added between views. 355 inner gap is nonzero. When _off_, gaps will only be added between views.