diff options
Diffstat (limited to 'sway/commands/bar.c')
-rw-r--r-- | sway/commands/bar.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sway/commands/bar.c b/sway/commands/bar.c index 04745a6e..ff111163 100644 --- a/sway/commands/bar.c +++ b/sway/commands/bar.c | |||
@@ -1,9 +1,8 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <string.h> | 1 | #include <string.h> |
3 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include <wlr/util/log.h> | ||
4 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
5 | #include "sway/config.h" | 5 | #include "sway/config.h" |
6 | #include "log.h" | ||
7 | #include "util.h" | 6 | #include "util.h" |
8 | 7 | ||
9 | struct cmd_results *cmd_bar(int argc, char **argv) { | 8 | struct cmd_results *cmd_bar(int argc, char **argv) { |
@@ -27,7 +26,6 @@ struct cmd_results *cmd_bar(int argc, char **argv) { | |||
27 | return bar_cmd_hidden_state(argc-1, argv + 1); | 26 | return bar_cmd_hidden_state(argc-1, argv + 1); |
28 | } | 27 | } |
29 | } | 28 | } |
30 | |||
31 | return cmd_results_new(CMD_FAILURE, "bar", "Can only be used in config file."); | 29 | return cmd_results_new(CMD_FAILURE, "bar", "Can only be used in config file."); |
32 | } | 30 | } |
33 | 31 | ||
@@ -38,15 +36,15 @@ struct cmd_results *cmd_bar(int argc, char **argv) { | |||
38 | } | 36 | } |
39 | 37 | ||
40 | // set bar id | 38 | // set bar id |
41 | int i; | 39 | for (int i = 0; i < config->bars->length; ++i) { |
42 | for (i = 0; i < config->bars->length; ++i) { | ||
43 | if (bar == config->bars->items[i]) { | 40 | if (bar == config->bars->items[i]) { |
44 | const int len = 5 + numlen(i); // "bar-" + i + \0 | 41 | const int len = 5 + numlen(i); // "bar-" + i + \0 |
45 | bar->id = malloc(len * sizeof(char)); | 42 | bar->id = malloc(len * sizeof(char)); |
46 | if (bar->id) { | 43 | if (bar->id) { |
47 | snprintf(bar->id, len, "bar-%d", i); | 44 | snprintf(bar->id, len, "bar-%d", i); |
48 | } else { | 45 | } else { |
49 | return cmd_results_new(CMD_FAILURE, "bar", "Unable to allocate bar ID"); | 46 | return cmd_results_new(CMD_FAILURE, |
47 | "bar", "Unable to allocate bar ID"); | ||
50 | } | 48 | } |
51 | break; | 49 | break; |
52 | } | 50 | } |
@@ -54,6 +52,6 @@ struct cmd_results *cmd_bar(int argc, char **argv) { | |||
54 | 52 | ||
55 | // Set current bar | 53 | // Set current bar |
56 | config->current_bar = bar; | 54 | config->current_bar = bar; |
57 | sway_log(L_DEBUG, "Configuring bar %s", bar->id); | 55 | wlr_log(L_DEBUG, "Configuring bar %s", bar->id); |
58 | return cmd_results_new(CMD_BLOCK_BAR, NULL, NULL); | 56 | return cmd_results_new(CMD_BLOCK_BAR, NULL, NULL); |
59 | } | 57 | } |