mirror of
https://github.com/swaywm/sway.git
synced 2026-04-25 06:46:24 -04:00
Replace wlr_log with sway_log
This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
This commit is contained in:
parent
5c834d36e1
commit
1211a81aad
108 changed files with 613 additions and 504 deletions
|
|
@ -59,7 +59,7 @@ static struct cmd_results *bar_cmd_bind(int argc, char **argv, bool code) {
|
|||
overwritten = true;
|
||||
bindings->items[i] = binding;
|
||||
free_bar_binding(other);
|
||||
wlr_log(WLR_DEBUG, "[bar %s] Updated binding for %u (%s)%s",
|
||||
sway_log(SWAY_DEBUG, "[bar %s] Updated binding for %u (%s)%s",
|
||||
config->current_bar->id, binding->button, name,
|
||||
binding->release ? " - release" : "");
|
||||
break;
|
||||
|
|
@ -67,7 +67,7 @@ static struct cmd_results *bar_cmd_bind(int argc, char **argv, bool code) {
|
|||
}
|
||||
if (!overwritten) {
|
||||
list_add(bindings, binding);
|
||||
wlr_log(WLR_DEBUG, "[bar %s] Added binding for %u (%s)%s",
|
||||
sway_log(SWAY_DEBUG, "[bar %s] Added binding for %u (%s)%s",
|
||||
config->current_bar->id, binding->button, name,
|
||||
binding->release ? " - release" : "");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ struct cmd_results *bar_cmd_binding_mode_indicator(int argc, char **argv) {
|
|||
config->current_bar->binding_mode_indicator =
|
||||
parse_boolean(argv[0], config->current_bar->binding_mode_indicator);
|
||||
if (config->current_bar->binding_mode_indicator) {
|
||||
wlr_log(WLR_DEBUG, "Enabling binding mode indicator on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Enabling binding mode indicator on bar: %s",
|
||||
config->current_bar->id);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Disabling binding mode indicator on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Disabling binding mode indicator on bar: %s",
|
||||
config->current_bar->id);
|
||||
}
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_font(int argc, char **argv) {
|
|||
char *font = join_args(argv, argc);
|
||||
free(config->current_bar->font);
|
||||
config->current_bar->font = font;
|
||||
wlr_log(WLR_DEBUG, "Settings font '%s' for bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Settings font '%s' for bar: %s",
|
||||
config->current_bar->font, config->current_bar->id);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ struct cmd_results *bar_cmd_gaps(int argc, char **argv) {
|
|||
config->current_bar->gaps.bottom = bottom;
|
||||
config->current_bar->gaps.left = left;
|
||||
|
||||
wlr_log(WLR_DEBUG, "Setting bar gaps to %d %d %d %d on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Setting bar gaps to %d %d %d %d on bar: %s",
|
||||
config->current_bar->gaps.top, config->current_bar->gaps.right,
|
||||
config->current_bar->gaps.bottom, config->current_bar->gaps.left,
|
||||
config->current_bar->id);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ struct cmd_results *bar_cmd_height(int argc, char **argv) {
|
|||
"Invalid height value: %s", argv[0]);
|
||||
}
|
||||
config->current_bar->height = height;
|
||||
wlr_log(WLR_DEBUG, "Setting bar height to %d on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Setting bar height to %d on bar: %s",
|
||||
height, config->current_bar->id);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ static struct cmd_results *bar_set_hidden_state(struct bar_config *bar,
|
|||
if (!config->reading) {
|
||||
ipc_event_barconfig_update(bar);
|
||||
}
|
||||
wlr_log(WLR_DEBUG, "Setting hidden_state: '%s' for bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Setting hidden_state: '%s' for bar: %s",
|
||||
bar->hidden_state, bar->id);
|
||||
}
|
||||
// free old mode
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ struct cmd_results *bar_cmd_icon_theme(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_FAILURE, "No bar defined.");
|
||||
}
|
||||
|
||||
wlr_log(WLR_DEBUG, "[Bar %s] Setting icon theme to %s",
|
||||
sway_log(SWAY_DEBUG, "[Bar %s] Setting icon theme to %s",
|
||||
config->current_bar->id, argv[0]);
|
||||
free(config->current_bar->icon_theme);
|
||||
config->current_bar->icon_theme = strdup(argv[0]);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ struct cmd_results *bar_cmd_id(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
wlr_log(WLR_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
|
||||
sway_log(SWAY_DEBUG, "Renaming bar: '%s' to '%s'", oldname, name);
|
||||
|
||||
// free old bar id
|
||||
free(config->current_bar->id);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
|
|||
if (!config->reading) {
|
||||
ipc_event_barconfig_update(bar);
|
||||
}
|
||||
wlr_log(WLR_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
|
||||
sway_log(SWAY_DEBUG, "Setting mode: '%s' for bar: %s", bar->mode, bar->id);
|
||||
}
|
||||
|
||||
// free old mode
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct cmd_results *bar_cmd_modifier(int argc, char **argv) {
|
|||
}
|
||||
list_free_items_and_destroy(split);
|
||||
config->current_bar->modifier = mod;
|
||||
wlr_log(WLR_DEBUG,
|
||||
sway_log(SWAY_DEBUG,
|
||||
"Show/Hide the bar when pressing '%s' in hide mode.", argv[0]);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ struct cmd_results *bar_cmd_output(int argc, char **argv) {
|
|||
|
||||
if (add_output) {
|
||||
list_add(outputs, strdup(output));
|
||||
wlr_log(WLR_DEBUG, "Adding bar: '%s' to output '%s'",
|
||||
sway_log(SWAY_DEBUG, "Adding bar: '%s' to output '%s'",
|
||||
config->current_bar->id, output);
|
||||
}
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) {
|
|||
config->current_bar->pango_markup
|
||||
= parse_boolean(argv[0], config->current_bar->pango_markup);
|
||||
if (config->current_bar->pango_markup) {
|
||||
wlr_log(WLR_DEBUG, "Enabling pango markup for bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Enabling pango markup for bar: %s",
|
||||
config->current_bar->id);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Disabling pango markup for bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Disabling pango markup for bar: %s",
|
||||
config->current_bar->id);
|
||||
}
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_position(int argc, char **argv) {
|
|||
char *valid[] = { "top", "bottom" };
|
||||
for (size_t i = 0; i < sizeof(valid) / sizeof(valid[0]); ++i) {
|
||||
if (strcasecmp(valid[i], argv[0]) == 0) {
|
||||
wlr_log(WLR_DEBUG, "Setting bar position '%s' for bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Setting bar position '%s' for bar: %s",
|
||||
argv[0], config->current_bar->id);
|
||||
free(config->current_bar->position);
|
||||
config->current_bar->position = strdup(argv[0]);
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct cmd_results *bar_cmd_separator_symbol(int argc, char **argv) {
|
|||
}
|
||||
free(config->current_bar->separator_symbol);
|
||||
config->current_bar->separator_symbol = strdup(argv[0]);
|
||||
wlr_log(WLR_DEBUG, "Settings separator_symbol '%s' for bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Settings separator_symbol '%s' for bar: %s",
|
||||
config->current_bar->separator_symbol, config->current_bar->id);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
|
|||
char *new_command = join_args(argv, argc);
|
||||
if (strcmp(new_command, "-") != 0) {
|
||||
config->current_bar->status_command = new_command;
|
||||
wlr_log(WLR_DEBUG, "Feeding bar with status command: %s",
|
||||
sway_log(SWAY_DEBUG, "Feeding bar with status command: %s",
|
||||
config->current_bar->status_command);
|
||||
} else {
|
||||
free(new_command);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_status_edge_padding(int argc, char **argv) {
|
|||
"Padding must be a positive integer");
|
||||
}
|
||||
config->current_bar->status_edge_padding = padding;
|
||||
wlr_log(WLR_DEBUG, "Status edge padding on bar %s: %d",
|
||||
sway_log(SWAY_DEBUG, "Status edge padding on bar %s: %d",
|
||||
config->current_bar->id, config->current_bar->status_edge_padding);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct cmd_results *bar_cmd_status_padding(int argc, char **argv) {
|
|||
"Padding must be a positive integer");
|
||||
}
|
||||
config->current_bar->status_padding = padding;
|
||||
wlr_log(WLR_DEBUG, "Status padding on bar %s: %d",
|
||||
sway_log(SWAY_DEBUG, "Status padding on bar %s: %d",
|
||||
config->current_bar->id, config->current_bar->status_padding);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ struct cmd_results *bar_cmd_strip_workspace_name(int argc, char **argv) {
|
|||
if (config->current_bar->strip_workspace_name) {
|
||||
config->current_bar->strip_workspace_numbers = false;
|
||||
|
||||
wlr_log(WLR_DEBUG, "Stripping workspace name on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Stripping workspace name on bar: %s",
|
||||
config->current_bar->id);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Enabling workspace name on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Enabling workspace name on bar: %s",
|
||||
config->current_bar->id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) {
|
|||
if (config->current_bar->strip_workspace_numbers) {
|
||||
config->current_bar->strip_workspace_name = false;
|
||||
|
||||
wlr_log(WLR_DEBUG, "Stripping workspace numbers on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Stripping workspace numbers on bar: %s",
|
||||
config->current_bar->id);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Enabling workspace numbers on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Enabling workspace numbers on bar: %s",
|
||||
config->current_bar->id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct cmd_results *bar_cmd_swaybar_command(int argc, char **argv) {
|
|||
}
|
||||
free(config->current_bar->swaybar_command);
|
||||
config->current_bar->swaybar_command = join_args(argv, argc);
|
||||
wlr_log(WLR_DEBUG, "Using custom swaybar command: %s",
|
||||
sway_log(SWAY_DEBUG, "Using custom swaybar command: %s",
|
||||
config->current_bar->swaybar_command);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) {
|
|||
other->command = binding->command;
|
||||
free(binding);
|
||||
binding = other;
|
||||
wlr_log(WLR_DEBUG,
|
||||
sway_log(SWAY_DEBUG,
|
||||
"[bar %s] Updated tray binding for %u (%s) to %s",
|
||||
config->current_bar->id, binding->button, name,
|
||||
binding->command);
|
||||
|
|
@ -76,7 +76,7 @@ static struct cmd_results *tray_bind(int argc, char **argv, bool code) {
|
|||
}
|
||||
if (!overwritten) {
|
||||
wl_list_insert(&config->current_bar->tray_bindings, &binding->link);
|
||||
wlr_log(WLR_DEBUG, "[bar %s] Added tray binding for %u (%s) to %s",
|
||||
sway_log(SWAY_DEBUG, "[bar %s] Added tray binding for %u (%s) to %s",
|
||||
config->current_bar->id, binding->button, name,
|
||||
binding->command);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,13 @@ struct cmd_results *bar_cmd_tray_output(int argc, char **argv) {
|
|||
}
|
||||
|
||||
if (strcmp(argv[0], "none") == 0) {
|
||||
wlr_log(WLR_DEBUG, "Hiding tray on bar: %s", config->current_bar->id);
|
||||
sway_log(SWAY_DEBUG, "Hiding tray on bar: %s", config->current_bar->id);
|
||||
for (int i = 0; i < outputs->length; ++i) {
|
||||
free(outputs->items[i]);
|
||||
}
|
||||
outputs->length = 0;
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Showing tray on output '%s' for bar: %s", argv[0],
|
||||
sway_log(SWAY_DEBUG, "Showing tray on output '%s' for bar: %s", argv[0],
|
||||
config->current_bar->id);
|
||||
}
|
||||
list_add(outputs, strdup(argv[0]));
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ struct cmd_results *bar_cmd_tray_padding(int argc, char **argv) {
|
|||
"Expected 'tray_padding <px> [px]'");
|
||||
}
|
||||
|
||||
wlr_log(WLR_DEBUG, "[Bar %s] Setting tray padding to %d", bar->id, padding);
|
||||
sway_log(SWAY_DEBUG, "[Bar %s] Setting tray padding to %d", bar->id, padding);
|
||||
config->current_bar->tray_padding = padding;
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_workspace_buttons(int argc, char **argv) {
|
|||
config->current_bar->workspace_buttons =
|
||||
parse_boolean(argv[0], config->current_bar->workspace_buttons);
|
||||
if (config->current_bar->workspace_buttons) {
|
||||
wlr_log(WLR_DEBUG, "Enabling workspace buttons on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Enabling workspace buttons on bar: %s",
|
||||
config->current_bar->id);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Disabling workspace buttons on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Disabling workspace buttons on bar: %s",
|
||||
config->current_bar->id);
|
||||
}
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ struct cmd_results *bar_cmd_wrap_scroll(int argc, char **argv) {
|
|||
config->current_bar->wrap_scroll =
|
||||
parse_boolean(argv[0], config->current_bar->wrap_scroll);
|
||||
if (config->current_bar->wrap_scroll) {
|
||||
wlr_log(WLR_DEBUG, "Enabling wrap scroll on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Enabling wrap scroll on bar: %s",
|
||||
config->current_bar->id);
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "Disabling wrap scroll on bar: %s",
|
||||
sway_log(SWAY_DEBUG, "Disabling wrap scroll on bar: %s",
|
||||
config->current_bar->id);
|
||||
}
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue