Add configuration option to disable window title

Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
This commit is contained in:
Felix Weilbach 2021-04-30 22:36:39 +02:00
parent 3d158264e2
commit 13835cf767
10 changed files with 62 additions and 16 deletions

View file

@ -35,6 +35,7 @@ static const struct cmd_handler bar_handlers[] = {
{ "tray_padding", bar_cmd_tray_padding },
{ "unbindcode", bar_cmd_unbindcode },
{ "unbindsym", bar_cmd_unbindsym },
{ "window_title", bar_cmd_window_title },
{ "workspace_buttons", bar_cmd_workspace_buttons },
{ "workspace_min_width", bar_cmd_workspace_min_width },
{ "wrap_scroll", bar_cmd_wrap_scroll },

View file

@ -0,0 +1,24 @@
#include <string.h>
#include <strings.h>
#include "sway/commands.h"
#include "log.h"
#include "util.h"
struct cmd_results *bar_cmd_window_title(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "window_title", EXPECTED_EQUAL_TO, 1))) {
return error;
}
config->current_bar->window_title =
parse_boolean(argv[0], config->current_bar->window_title);
if (config->current_bar->window_title) {
sway_log(SWAY_DEBUG,
"Enabling window title on bar: %s",
config->current_bar->id);
} else {
sway_log(SWAY_DEBUG,
"Disabling window title on bar: %s",
config->current_bar->id);
}
return cmd_results_new(CMD_SUCCESS, NULL);
}

View file

@ -96,6 +96,7 @@ struct bar_config *default_bar_config(void) {
bar->font = NULL;
bar->height = 0;
bar->workspace_buttons = true;
bar->window_title = false;
bar->wrap_scroll = false;
bar->separator_symbol = NULL;
bar->strip_workspace_numbers = false;

View file

@ -1104,6 +1104,8 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
json_object_new_boolean(bar->wrap_scroll));
json_object_object_add(json, "workspace_buttons",
json_object_new_boolean(bar->workspace_buttons));
json_object_object_add(json, "window_title",
json_object_new_boolean(bar->window_title));
json_object_object_add(json, "strip_workspace_numbers",
json_object_new_boolean(bar->strip_workspace_numbers));
json_object_object_add(json, "strip_workspace_name",

View file

@ -144,6 +144,7 @@ sway_sources = files(
'commands/bar/tray_output.c',
'commands/bar/tray_padding.c',
'commands/bar/workspace_buttons.c',
'commands/bar/window_title.c',
'commands/bar/workspace_min_width.c',
'commands/bar/wrap_scroll.c',