aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/sticky.c
diff options
context:
space:
mode:
authorLibravatar Connor E <38229097+c-edw@users.noreply.github.com>2018-11-10 12:55:06 +0000
committerLibravatar Connor E <38229097+c-edw@users.noreply.github.com>2018-11-10 12:55:06 +0000
commitb865dabebab717fea75f91e8ccebabc99e36bdd9 (patch)
treedf51bf83b899933f1347508b9f1bd55aefa21ae5 /sway/commands/sticky.c
parentMerge pull request #3085 from 7415963987456321/master (diff)
downloadsway-b865dabebab717fea75f91e8ccebabc99e36bdd9.tar.gz
sway-b865dabebab717fea75f91e8ccebabc99e36bdd9.tar.zst
sway-b865dabebab717fea75f91e8ccebabc99e36bdd9.zip
Use parse_boolean where possible.
Diffstat (limited to 'sway/commands/sticky.c')
-rw-r--r--sway/commands/sticky.c17
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
13struct cmd_results *cmd_sticky(int argc, char **argv) { 14struct 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);