diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 25 | ||||
-rw-r--r-- | sway/config.c | 1 | ||||
-rw-r--r-- | sway/ipc-server.c | 1 | ||||
-rw-r--r-- | sway/sway-bar.5.txt | 3 |
4 files changed, 30 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index b7c1a344..11284577 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -103,6 +103,7 @@ static sway_cmd bar_cmd_id; static sway_cmd bar_cmd_position; static sway_cmd bar_cmd_separator_symbol; static sway_cmd bar_cmd_status_command; +static sway_cmd bar_cmd_pango_markup; static sway_cmd bar_cmd_strip_workspace_numbers; static sway_cmd bar_cmd_swaybar_command; static sway_cmd bar_cmd_tray_output; @@ -2757,6 +2758,29 @@ static struct cmd_results *bar_cmd_status_command(int argc, char **argv) { return cmd_results_new(CMD_SUCCESS, NULL, NULL); } +static struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "pango_markup", EXPECTED_EQUAL_TO, 1))) { + return error; + } + + if (!config->current_bar) { + return cmd_results_new(CMD_FAILURE, "pango_markup", "No bar defined."); + } + + if (strcasecmp("enabled", argv[0]) == 0) { + config->current_bar->pango_markup = true; + sway_log(L_DEBUG, "Enabling pango markup for bar: %s", config->current_bar->id); + } else if (strcasecmp("disabled", argv[0]) == 0) { + config->current_bar->pango_markup = false; + sway_log(L_DEBUG, "Disabling pango markup for bar: %s", config->current_bar->id); + } else { + error = cmd_results_new(CMD_INVALID, "pango_markup", "Invalid value %s", argv[0]); + return error; + } + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} + static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { @@ -2861,6 +2885,7 @@ static struct cmd_handler bar_handlers[] = { { "mode", bar_cmd_mode }, { "modifier", bar_cmd_modifier }, { "output", bar_cmd_output }, + { "pango_markup", bar_cmd_pango_markup }, { "position", bar_cmd_position }, { "separator_symbol", bar_cmd_separator_symbol }, { "status_command", bar_cmd_status_command }, diff --git a/sway/config.c b/sway/config.c index a917d348..ebcee95b 100644 --- a/sway/config.c +++ b/sway/config.c @@ -1022,6 +1022,7 @@ struct bar_config *default_bar_config(void) { bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; bar->bindings = create_list(); bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done"); + bar->pango_markup = true; bar->swaybar_command = NULL; bar->font = NULL; bar->height = -1; diff --git a/sway/ipc-server.c b/sway/ipc-server.c index f6116921..4d9264e8 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c @@ -600,6 +600,7 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) { json_object_object_add(json, "strip_workspace_numbers", json_object_new_boolean(bar->strip_workspace_numbers)); json_object_object_add(json, "binding_mode_indicator", json_object_new_boolean(bar->binding_mode_indicator)); json_object_object_add(json, "verbose", json_object_new_boolean(bar->verbose)); + json_object_object_add(json, "pango_markup", json_object_new_boolean(bar->pango_markup)); json_object *colors = json_object_new_object(); json_object_object_add(colors, "background", json_object_new_string(bar->colors.background)); diff --git a/sway/sway-bar.5.txt b/sway/sway-bar.5.txt index c23519a4..30c7d9bf 100644 --- a/sway/sway-bar.5.txt +++ b/sway/sway-bar.5.txt @@ -21,6 +21,9 @@ Commands **status_command** <status command>:: Executes the bar _status command_ with _sh -c_. +**pango_markup** <enabled|disabled>:: + Enables or disables pango markup for plaintext statuslines. + **id** <bar_id>:: Sets the ID of the bar. |