Renamed to pango_markup
This commit is contained in:
parent
ee4e245f16
commit
0f1cfdec61
|
@ -20,7 +20,7 @@ struct box_colors {
|
||||||
*/
|
*/
|
||||||
struct config {
|
struct config {
|
||||||
char *status_command;
|
char *status_command;
|
||||||
bool plaintext_markup;
|
bool pango_markup;
|
||||||
uint32_t position;
|
uint32_t position;
|
||||||
char *font;
|
char *font;
|
||||||
char *sep_symbol;
|
char *sep_symbol;
|
||||||
|
|
|
@ -116,7 +116,7 @@ struct bar_config {
|
||||||
enum desktop_shell_panel_position position;
|
enum desktop_shell_panel_position position;
|
||||||
list_t *bindings;
|
list_t *bindings;
|
||||||
char *status_command;
|
char *status_command;
|
||||||
bool plaintext_markup;
|
bool pango_markup;
|
||||||
char *swaybar_command;
|
char *swaybar_command;
|
||||||
char *font;
|
char *font;
|
||||||
int height; // -1 not defined
|
int height; // -1 not defined
|
||||||
|
|
|
@ -103,7 +103,7 @@ static sway_cmd bar_cmd_id;
|
||||||
static sway_cmd bar_cmd_position;
|
static sway_cmd bar_cmd_position;
|
||||||
static sway_cmd bar_cmd_separator_symbol;
|
static sway_cmd bar_cmd_separator_symbol;
|
||||||
static sway_cmd bar_cmd_status_command;
|
static sway_cmd bar_cmd_status_command;
|
||||||
static sway_cmd bar_cmd_plaintext_markup;
|
static sway_cmd bar_cmd_pango_markup;
|
||||||
static sway_cmd bar_cmd_strip_workspace_numbers;
|
static sway_cmd bar_cmd_strip_workspace_numbers;
|
||||||
static sway_cmd bar_cmd_swaybar_command;
|
static sway_cmd bar_cmd_swaybar_command;
|
||||||
static sway_cmd bar_cmd_tray_output;
|
static sway_cmd bar_cmd_tray_output;
|
||||||
|
@ -2758,24 +2758,24 @@ static struct cmd_results *bar_cmd_status_command(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cmd_results *bar_cmd_plaintext_markup(int argc, char **argv) {
|
static struct cmd_results *bar_cmd_pango_markup(int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
if ((error = checkarg(argc, "plaintext_markup", EXPECTED_EQUAL_TO, 1))) {
|
if ((error = checkarg(argc, "pango_markup", EXPECTED_EQUAL_TO, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config->current_bar) {
|
if (!config->current_bar) {
|
||||||
return cmd_results_new(CMD_FAILURE, "plaintext_markup", "No bar defined.");
|
return cmd_results_new(CMD_FAILURE, "pango_markup", "No bar defined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp("pango", argv[0]) == 0) {
|
if (strcasecmp("pango", argv[0]) == 0) {
|
||||||
config->current_bar->plaintext_markup = true;
|
config->current_bar->pango_markup = true;
|
||||||
sway_log(L_DEBUG, "Enabling pango markup for bar: %s", config->current_bar->id);
|
sway_log(L_DEBUG, "Enabling pango markup for bar: %s", config->current_bar->id);
|
||||||
} else if (strcasecmp("none", argv[0]) == 0) {
|
} else if (strcasecmp("none", argv[0]) == 0) {
|
||||||
config->current_bar->plaintext_markup = false;
|
config->current_bar->pango_markup = false;
|
||||||
sway_log(L_DEBUG, "Disabling pango markup for bar: %s", config->current_bar->id);
|
sway_log(L_DEBUG, "Disabling pango markup for bar: %s", config->current_bar->id);
|
||||||
} else {
|
} else {
|
||||||
error = cmd_results_new(CMD_INVALID, "plaintext_markup", "Invalid value %s", argv[0]);
|
error = cmd_results_new(CMD_INVALID, "pango_markup", "Invalid value %s", argv[0]);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
|
||||||
|
@ -2885,7 +2885,7 @@ static struct cmd_handler bar_handlers[] = {
|
||||||
{ "mode", bar_cmd_mode },
|
{ "mode", bar_cmd_mode },
|
||||||
{ "modifier", bar_cmd_modifier },
|
{ "modifier", bar_cmd_modifier },
|
||||||
{ "output", bar_cmd_output },
|
{ "output", bar_cmd_output },
|
||||||
{ "plaintext_markup", bar_cmd_plaintext_markup },
|
{ "pango_markup", bar_cmd_pango_markup },
|
||||||
{ "position", bar_cmd_position },
|
{ "position", bar_cmd_position },
|
||||||
{ "separator_symbol", bar_cmd_separator_symbol },
|
{ "separator_symbol", bar_cmd_separator_symbol },
|
||||||
{ "status_command", bar_cmd_status_command },
|
{ "status_command", bar_cmd_status_command },
|
||||||
|
|
|
@ -1022,7 +1022,7 @@ struct bar_config *default_bar_config(void) {
|
||||||
bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
|
bar->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
|
||||||
bar->bindings = create_list();
|
bar->bindings = create_list();
|
||||||
bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done");
|
bar->status_command = strdup("while :; do date +'%Y-%m-%d %l:%M:%S %p' && sleep 1; done");
|
||||||
bar->plaintext_markup = true;
|
bar->pango_markup = true;
|
||||||
bar->swaybar_command = NULL;
|
bar->swaybar_command = NULL;
|
||||||
bar->font = NULL;
|
bar->font = NULL;
|
||||||
bar->height = -1;
|
bar->height = -1;
|
||||||
|
|
|
@ -600,7 +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, "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, "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, "verbose", json_object_new_boolean(bar->verbose));
|
||||||
json_object_object_add(json, "plaintext_markup", json_object_new_boolean(bar->plaintext_markup));
|
json_object_object_add(json, "pango_markup", json_object_new_boolean(bar->pango_markup));
|
||||||
|
|
||||||
json_object *colors = json_object_new_object();
|
json_object *colors = json_object_new_object();
|
||||||
json_object_object_add(colors, "background", json_object_new_string(bar->colors.background));
|
json_object_object_add(colors, "background", json_object_new_string(bar->colors.background));
|
||||||
|
|
|
@ -21,7 +21,7 @@ Commands
|
||||||
**status_command** <status command>::
|
**status_command** <status command>::
|
||||||
Executes the bar _status command_ with _sh -c_.
|
Executes the bar _status command_ with _sh -c_.
|
||||||
|
|
||||||
**plaintext_markup** <pango|none>::
|
**pango_markup** <pango|none>::
|
||||||
Enables or disables pango markup for plaintext statuslines.
|
Enables or disables pango markup for plaintext statuslines.
|
||||||
|
|
||||||
**id** <bar_id>::
|
**id** <bar_id>::
|
||||||
|
|
|
@ -46,7 +46,7 @@ char *parse_font(const char *font) {
|
||||||
struct config *init_config() {
|
struct config *init_config() {
|
||||||
struct config *config = calloc(1, sizeof(struct config));
|
struct config *config = calloc(1, sizeof(struct config));
|
||||||
config->status_command = NULL;
|
config->status_command = NULL;
|
||||||
config->plaintext_markup = true;
|
config->pango_markup = true;
|
||||||
config->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
|
config->position = DESKTOP_SHELL_PANEL_POSITION_BOTTOM;
|
||||||
config->font = strdup("monospace 10");
|
config->font = strdup("monospace 10");
|
||||||
config->mode = NULL;
|
config->mode = NULL;
|
||||||
|
|
|
@ -27,7 +27,7 @@ static void ipc_parse_config(struct config *config, const char *payload) {
|
||||||
json_object_object_get_ex(bar_config, "separator_symbol", &sep_symbol);
|
json_object_object_get_ex(bar_config, "separator_symbol", &sep_symbol);
|
||||||
json_object_object_get_ex(bar_config, "colors", &colors);
|
json_object_object_get_ex(bar_config, "colors", &colors);
|
||||||
json_object_object_get_ex(bar_config, "outputs", &outputs);
|
json_object_object_get_ex(bar_config, "outputs", &outputs);
|
||||||
json_object_object_get_ex(bar_config, "plaintext_markup", &markup);
|
json_object_object_get_ex(bar_config, "pango_markup", &markup);
|
||||||
|
|
||||||
if (status_command) {
|
if (status_command) {
|
||||||
free(config->status_command);
|
free(config->status_command);
|
||||||
|
@ -65,7 +65,7 @@ static void ipc_parse_config(struct config *config, const char *payload) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (markup) {
|
if (markup) {
|
||||||
config->plaintext_markup = json_object_get_boolean(markup);
|
config->pango_markup = json_object_get_boolean(markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// free previous outputs list
|
// free previous outputs list
|
||||||
|
|
|
@ -278,9 +278,9 @@ void render(struct output *output, struct config *config, struct status_line *li
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
if (line->protocol == TEXT) {
|
if (line->protocol == TEXT) {
|
||||||
get_text_size(window->cairo, window->font, &width, &height, config->plaintext_markup, "%s", line->text_line);
|
get_text_size(window->cairo, window->font, &width, &height, config->pango_markup, "%s", line->text_line);
|
||||||
cairo_move_to(cairo, window->width - margin - width, margin);
|
cairo_move_to(cairo, window->width - margin - width, margin);
|
||||||
pango_printf(window->cairo, window->font, config->plaintext_markup, "%s", line->text_line);
|
pango_printf(window->cairo, window->font, config->pango_markup, "%s", line->text_line);
|
||||||
} else if (line->protocol == I3BAR && line->block_line) {
|
} else if (line->protocol == I3BAR && line->block_line) {
|
||||||
double pos = window->width - 0.5;
|
double pos = window->width - 0.5;
|
||||||
bool edge = true;
|
bool edge = true;
|
||||||
|
|
Loading…
Reference in a new issue