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; | |||
103 | static sway_cmd bar_cmd_position; | 103 | static sway_cmd bar_cmd_position; |
104 | static sway_cmd bar_cmd_separator_symbol; | 104 | static sway_cmd bar_cmd_separator_symbol; |
105 | static sway_cmd bar_cmd_status_command; | 105 | static sway_cmd bar_cmd_status_command; |
106 | static sway_cmd bar_cmd_pango_markup; | ||
106 | static sway_cmd bar_cmd_strip_workspace_numbers; | 107 | static sway_cmd bar_cmd_strip_workspace_numbers; |
107 | static sway_cmd bar_cmd_swaybar_command; | 108 | static sway_cmd bar_cmd_swaybar_command; |
108 | static sway_cmd bar_cmd_tray_output; | 109 | static sway_cmd bar_cmd_tray_output; |
@@ -2757,6 +2758,29 @@ static struct cmd_results *bar_cmd_status_command(int argc, char **argv) { | |||
2757 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 2758 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
2758 | } | 2759 | } |
2759 | 2760 | ||
2761 | static struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) { | ||
2762 | struct cmd_results *error = NULL; | ||
2763 | if ((error = checkarg(argc, "pango_markup", EXPECTED_EQUAL_TO, 1))) { | ||
2764 | return error; | ||
2765 | } | ||
2766 | |||
2767 | if (!config->current_bar) { | ||
2768 | return cmd_results_new(CMD_FAILURE, "pango_markup", "No bar defined."); | ||
2769 | } | ||
2770 | |||
2771 | if (strcasecmp("enabled", argv[0]) == 0) { | ||
2772 | config->current_bar->pango_markup = true; | ||
2773 | sway_log(L_DEBUG, "Enabling pango markup for bar: %s", config->current_bar->id); | ||
2774 | } else if (strcasecmp("disabled", argv[0]) == 0) { | ||
2775 | config->current_bar->pango_markup = false; | ||
2776 | sway_log(L_DEBUG, "Disabling pango markup for bar: %s", config->current_bar->id); | ||
2777 | } else { | ||
2778 | error = cmd_results_new(CMD_INVALID, "pango_markup", "Invalid value %s", argv[0]); | ||
2779 | return error; | ||
2780 | } | ||
2781 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
2782 | } | ||
2783 | |||
2760 | static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { | 2784 | static struct cmd_results *bar_cmd_strip_workspace_numbers(int argc, char **argv) { |
2761 | struct cmd_results *error = NULL; | 2785 | struct cmd_results *error = NULL; |
2762 | if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { | 2786 | if ((error = checkarg(argc, "strip_workspace_numbers", EXPECTED_EQUAL_TO, 1))) { |
@@ -2861,6 +2885,7 @@ static struct cmd_handler bar_handlers[] = { | |||
2861 | { "mode", bar_cmd_mode }, | 2885 | { "mode", bar_cmd_mode }, |
2862 | { "modifier", bar_cmd_modifier }, | 2886 | { "modifier", bar_cmd_modifier }, |
2863 | { "output", bar_cmd_output }, | 2887 | { "output", bar_cmd_output }, |
2888 | { "pango_markup", bar_cmd_pango_markup }, | ||
2864 | { "position", bar_cmd_position }, | 2889 | { "position", bar_cmd_position }, |
2865 | { "separator_symbol", bar_cmd_separator_symbol }, | 2890 | { "separator_symbol", bar_cmd_separator_symbol }, |
2866 | { "status_command", bar_cmd_status_command }, | 2891 | { "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) { | |||
1022 | bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; | 1022 | bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM; |
1023 | bar->bindings = create_list(); | 1023 | bar->bindings = create_list(); |
1024 | bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done"); | 1024 | bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done"); |
1025 | bar->pango_markup = true; | ||
1025 | bar->swaybar_command = NULL; | 1026 | bar->swaybar_command = NULL; |
1026 | bar->font = NULL; | 1027 | bar->font = NULL; |
1027 | bar->height = -1; | 1028 | 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) { | |||
600 | json_object_object_add(json, "strip_workspace_numbers", json_object_new_boolean(bar->strip_workspace_numbers)); | 600 | json_object_object_add(json, "strip_workspace_numbers", json_object_new_boolean(bar->strip_workspace_numbers)); |
601 | json_object_object_add(json, "binding_mode_indicator", json_object_new_boolean(bar->binding_mode_indicator)); | 601 | json_object_object_add(json, "binding_mode_indicator", json_object_new_boolean(bar->binding_mode_indicator)); |
602 | json_object_object_add(json, "verbose", json_object_new_boolean(bar->verbose)); | 602 | json_object_object_add(json, "verbose", json_object_new_boolean(bar->verbose)); |
603 | json_object_object_add(json, "pango_markup", json_object_new_boolean(bar->pango_markup)); | ||
603 | 604 | ||
604 | json_object *colors = json_object_new_object(); | 605 | json_object *colors = json_object_new_object(); |
605 | json_object_object_add(colors, "background", json_object_new_string(bar->colors.background)); | 606 | 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 | |||
21 | **status_command** <status command>:: | 21 | **status_command** <status command>:: |
22 | Executes the bar _status command_ with _sh -c_. | 22 | Executes the bar _status command_ with _sh -c_. |
23 | 23 | ||
24 | **pango_markup** <enabled|disabled>:: | ||
25 | Enables or disables pango markup for plaintext statuslines. | ||
26 | |||
24 | **id** <bar_id>:: | 27 | **id** <bar_id>:: |
25 | Sets the ID of the bar. | 28 | Sets the ID of the bar. |
26 | 29 | ||