aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
Diffstat (limited to 'sway')
-rw-r--r--sway/commands.c9
-rw-r--r--sway/config.c23
2 files changed, 19 insertions, 13 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 548b7d9f..3b8556ca 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -1526,14 +1526,7 @@ static struct cmd_results *cmd_reload(int argc, char **argv) {
}
if (!load_config(NULL)) return cmd_results_new(CMD_FAILURE, "reload", "Error(s) reloading config.");
- int i;
- swayc_t *cont = NULL;
- for (i = 0; i < root_container.children->length; ++i) {
- cont = root_container.children->items[i];
- if (cont->type == C_OUTPUT) {
- load_swaybars(cont);
- }
- }
+ load_swaybars();
arrange_windows(&root_container, -1, -1);
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
diff --git a/sway/config.c b/sway/config.c
index c34a660e..16adaf0d 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -529,7 +529,20 @@ void terminate_swaybg(pid_t pid) {
}
}
-void load_swaybars(swayc_t *output) {
+static bool active_output(const char *name) {
+ int i;
+ swayc_t *cont = NULL;
+ for (i = 0; i < root_container.children->length; ++i) {
+ cont = root_container.children->items[i];
+ if (cont->type == C_OUTPUT && strcasecmp(name, cont->name) == 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void load_swaybars() {
// Check for bars
list_t *bars = create_list();
struct bar_config *bar = NULL;
@@ -541,7 +554,7 @@ void load_swaybars(swayc_t *output) {
int j;
for (j = 0; j < bar->outputs->length; ++j) {
char *o = bar->outputs->items[j];
- if (!strcmp(o, "*") || !strcasecmp(o, output->name)) {
+ if (!strcmp(o, "*") || active_output(o)) {
apply = true;
break;
}
@@ -559,7 +572,7 @@ void load_swaybars(swayc_t *output) {
if (bar->pid != 0) {
terminate_swaybar(bar->pid);
}
- sway_log(L_DEBUG, "Invoking swaybar for output %s and bar '%s'", output->name, bar->id);
+ sway_log(L_DEBUG, "Invoking swaybar for bar id '%s'", bar->id);
invoke_swaybar(bar);
}
@@ -683,8 +696,8 @@ void apply_output_config(struct output_config *oc, swayc_t *output) {
}
}
- // load swaybars for output
- load_swaybars(output);
+ // reload swaybars
+ load_swaybars();
}
char *do_var_replacement(char *str) {