aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/bar/output.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/bar/output.c')
-rw-r--r--sway/commands/bar/output.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/sway/commands/bar/output.c b/sway/commands/bar/output.c
index a5710bc0..f7ca0aa4 100644
--- a/sway/commands/bar/output.c
+++ b/sway/commands/bar/output.c
@@ -1,4 +1,5 @@
#define _XOPEN_SOURCE 500
+#include <stdbool.h>
#include <string.h>
#include "sway/commands.h"
#include "list.h"
@@ -9,7 +10,6 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
if ((error = checkarg(argc, "output", EXPECTED_EQUAL_TO, 1))) {
return error;
}
-
if (!config->current_bar) {
return cmd_results_new(CMD_FAILURE, "output", "No bar defined.");
}
@@ -21,21 +21,20 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
config->current_bar->outputs = outputs;
}
- int i;
- int add_output = 1;
+ bool add_output = true;
if (strcmp("*", output) == 0) {
// remove all previous defined outputs and replace with '*'
- for (i = 0; i < outputs->length; ++i) {
+ for (int i = 0; i < outputs->length; ++i) {
free(outputs->items[i]);
list_del(outputs, i);
}
} else {
// only add output if not already defined with either the same
// name or as '*'
- for (i = 0; i < outputs->length; ++i) {
+ for (int i = 0; i < outputs->length; ++i) {
const char *find = outputs->items[i];
if (strcmp("*", find) == 0 || strcmp(output, find) == 0) {
- add_output = 0;
+ add_output = false;
break;
}
}
@@ -43,8 +42,8 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
if (add_output) {
list_add(outputs, strdup(output));
- sway_log(L_DEBUG, "Adding bar: '%s' to output '%s'", config->current_bar->id, output);
+ wlr_log(L_DEBUG, "Adding bar: '%s' to output '%s'",
+ config->current_bar->id, output);
}
-
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}