aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bar/mode.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 22:05:16 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-03-29 22:11:08 -0400
commit741424c4e7811c12d8cca28466f89bd61eaf3a75 (patch)
tree37af2aa063d42bf6ef3bc967bb1a5b6b679abbaf /sway/commands/bar/mode.c
parentUse statically allocated text buffer (diff)
downloadsway-741424c4e7811c12d8cca28466f89bd61eaf3a75.tar.gz
sway-741424c4e7811c12d8cca28466f89bd61eaf3a75.tar.zst
sway-741424c4e7811c12d8cca28466f89bd61eaf3a75.zip
Clean up imported bar commands
Diffstat (limited to 'sway/commands/bar/mode.c')
-rw-r--r--sway/commands/bar/mode.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 7d346956..34bb0a4f 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -44,13 +44,12 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
44 if ((error = checkarg(argc, "mode", EXPECTED_LESS_THAN, 3))) { 44 if ((error = checkarg(argc, "mode", EXPECTED_LESS_THAN, 3))) {
45 return error; 45 return error;
46 } 46 }
47
48 if (config->reading && argc > 1) { 47 if (config->reading && argc > 1) {
49 return cmd_results_new(CMD_INVALID, "mode", "Unexpected value %s in config mode", argv[1]); 48 return cmd_results_new(CMD_INVALID,
49 "mode", "Unexpected value %s in config mode", argv[1]);
50 } 50 }
51 51
52 const char *mode = argv[0]; 52 const char *mode = argv[0];
53
54 if (config->reading) { 53 if (config->reading) {
55 return bar_set_mode(config->current_bar, mode); 54 return bar_set_mode(config->current_bar, mode);
56 } 55 }
@@ -60,19 +59,16 @@ struct cmd_results *bar_cmd_mode(int argc, char **argv) {
60 id = argv[1]; 59 id = argv[1];
61 } 60 }
62 61
63 int i;
64 struct bar_config *bar; 62 struct bar_config *bar;
65 for (i = 0; i < config->bars->length; ++i) { 63 for (int i = 0; i < config->bars->length; ++i) {
66 bar = config->bars->items[i]; 64 bar = config->bars->items[i];
67 if (id && strcmp(id, bar->id) == 0) { 65 if (id && strcmp(id, bar->id) == 0) {
68 return bar_set_mode(bar, mode); 66 return bar_set_mode(bar, mode);
69 } 67 }
70
71 error = bar_set_mode(bar, mode); 68 error = bar_set_mode(bar, mode);
72 if (error) { 69 if (error) {
73 return error; 70 return error;
74 } 71 }
75 } 72 }
76
77 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 73 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
78} 74}