mirror of
https://github.com/swaywm/sway.git
synced 2026-02-05 04:06:25 -05:00
Merge 03bd0c74c0 into 845cdb190f
This commit is contained in:
commit
20166108bb
10 changed files with 35 additions and 0 deletions
|
|
@ -245,6 +245,7 @@ sway_cmd bar_colors_cmd_focused_separator;
|
|||
sway_cmd bar_colors_cmd_statusline;
|
||||
sway_cmd bar_colors_cmd_focused_statusline;
|
||||
sway_cmd bar_colors_cmd_urgent_workspace;
|
||||
sway_cmd bar_colors_cmd_tray_background;
|
||||
|
||||
sway_cmd input_cmd_seat;
|
||||
sway_cmd input_cmd_accel_profile;
|
||||
|
|
|
|||
|
|
@ -404,6 +404,9 @@ struct bar_config {
|
|||
char *binding_mode_border;
|
||||
char *binding_mode_bg;
|
||||
char *binding_mode_text;
|
||||
#if HAVE_TRAY
|
||||
char *tray_background;
|
||||
#endif
|
||||
} colors;
|
||||
|
||||
#if HAVE_TRAY
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ struct swaybar_config {
|
|||
struct box_colors inactive_workspace;
|
||||
struct box_colors urgent_workspace;
|
||||
struct box_colors binding_mode;
|
||||
|
||||
uint32_t tray_background;
|
||||
} colors;
|
||||
|
||||
#if HAVE_TRAY
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ static const struct cmd_handler bar_colors_handlers[] = {
|
|||
{ "separator", bar_colors_cmd_separator },
|
||||
{ "statusline", bar_colors_cmd_statusline },
|
||||
{ "urgent_workspace", bar_colors_cmd_urgent_workspace },
|
||||
#if HAVE_TRAY
|
||||
{ "tray_background", bar_colors_cmd_tray_background },
|
||||
#endif
|
||||
};
|
||||
|
||||
static char *hex_to_rgba_hex(const char *hex) {
|
||||
|
|
@ -154,3 +157,10 @@ struct cmd_results *bar_colors_cmd_urgent_workspace(int argc, char **argv) {
|
|||
};
|
||||
return parse_three_colors(colors, "urgent_workspace", argc, argv);
|
||||
}
|
||||
|
||||
#if HAVE_TRAY
|
||||
struct cmd_results *bar_colors_cmd_tray_background(int argc, char **argv) {
|
||||
return parse_single_color(&(config->current_bar->colors.tray_background),
|
||||
"tray_background", argc, argv);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ struct bar_config *default_bar_config(void) {
|
|||
bar->colors.binding_mode_text = NULL;
|
||||
|
||||
#if HAVE_TRAY
|
||||
bar->colors.tray_background = NULL;
|
||||
bar->tray_padding = 2;
|
||||
wl_list_init(&bar->tray_bindings);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1404,6 +1404,16 @@ json_object *ipc_json_describe_bar_config(struct bar_config *bar) {
|
|||
json_object_new_string(bar->colors.urgent_workspace_text));
|
||||
}
|
||||
|
||||
#if HAVE_TRAY
|
||||
if (bar->colors.tray_background) {
|
||||
json_object_object_add(colors, "tray_background",
|
||||
json_object_new_string(bar->colors.tray_background));
|
||||
} else {
|
||||
json_object_object_add(colors, "tray_background",
|
||||
json_object_new_string(bar->colors.background));
|
||||
}
|
||||
#endif
|
||||
|
||||
json_object_object_add(json, "colors", colors);
|
||||
|
||||
if (bar->bindings->length > 0) {
|
||||
|
|
|
|||
|
|
@ -232,6 +232,9 @@ must be defined in hex: _#RRGGBB_ or _#RRGGBBAA_.
|
|||
Border, background and text color for the binding mode indicator. If not used,
|
||||
the colors will be taken from _urgent_workspace_.
|
||||
|
||||
*tray_background* <color>
|
||||
Background color of the system tray.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*sway*(5) *swaybar-protocol*(7)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ struct swaybar_config *init_config(void) {
|
|||
config->colors.binding_mode.text = 0xFFFFFFFF;
|
||||
|
||||
#if HAVE_TRAY
|
||||
config->colors.tray_background = 0x000000FF;
|
||||
config->tray_padding = 2;
|
||||
wl_list_init(&config->tray_bindings);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ static void ipc_parse_colors(
|
|||
{ "binding_mode_border", &config->colors.binding_mode.border },
|
||||
{ "binding_mode_bg", &config->colors.binding_mode.background },
|
||||
{ "binding_mode_text", &config->colors.binding_mode.text },
|
||||
{ "tray_background", &config->colors.tray_background },
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(properties) / sizeof(properties[i]); i++) {
|
||||
|
|
|
|||
|
|
@ -514,6 +514,9 @@ uint32_t render_sni(cairo_t *cairo, struct swaybar_output *output, double *x,
|
|||
cairo_set_operator(cairo, CAIRO_OPERATOR_OVER);
|
||||
|
||||
cairo_matrix_t scale_matrix;
|
||||
cairo_set_source_u32(cairo, output->bar->config->colors.tray_background);
|
||||
cairo_rectangle(cairo, *x, icon_y, size, size);
|
||||
cairo_fill(cairo);
|
||||
cairo_pattern_t *icon_pattern = cairo_pattern_create_for_surface(icon);
|
||||
// TODO: check cairo_pattern_status for "ENOMEM"
|
||||
cairo_matrix_init_scale(&scale_matrix, output->scale, output->scale);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue