diff options
Diffstat (limited to 'sway/commands/sticky.c')
-rw-r--r-- | sway/commands/sticky.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c index f18322b7..7cd358a4 100644 --- a/sway/commands/sticky.c +++ b/sway/commands/sticky.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "sway/tree/view.h" | 9 | #include "sway/tree/view.h" |
10 | #include "sway/tree/workspace.h" | 10 | #include "sway/tree/workspace.h" |
11 | #include "list.h" | 11 | #include "list.h" |
12 | #include "util.h" | ||
12 | 13 | ||
13 | struct cmd_results *cmd_sticky(int argc, char **argv) { | 14 | struct cmd_results *cmd_sticky(int argc, char **argv) { |
14 | struct cmd_results *error = NULL; | 15 | struct cmd_results *error = NULL; |
@@ -26,21 +27,9 @@ struct cmd_results *cmd_sticky(int argc, char **argv) { | |||
26 | "Can't set sticky on a tiled container"); | 27 | "Can't set sticky on a tiled container"); |
27 | } | 28 | } |
28 | 29 | ||
29 | bool wants_sticky; | 30 | container->is_sticky = parse_boolean(argv[0], container->is_sticky); |
30 | if (strcasecmp(argv[0], "enable") == 0) { | ||
31 | wants_sticky = true; | ||
32 | } else if (strcasecmp(argv[0], "disable") == 0) { | ||
33 | wants_sticky = false; | ||
34 | } else if (strcasecmp(argv[0], "toggle") == 0) { | ||
35 | wants_sticky = !container->is_sticky; | ||
36 | } else { | ||
37 | return cmd_results_new(CMD_FAILURE, "sticky", | ||
38 | "Expected 'sticky <enable|disable|toggle>'"); | ||
39 | } | ||
40 | |||
41 | container->is_sticky = wants_sticky; | ||
42 | 31 | ||
43 | if (wants_sticky) { | 32 | if (container->is_sticky) { |
44 | // move container to active workspace | 33 | // move container to active workspace |
45 | struct sway_workspace *active_workspace = | 34 | struct sway_workspace *active_workspace = |
46 | output_get_active_workspace(container->workspace->output); | 35 | output_get_active_workspace(container->workspace->output); |