mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
theme: add window_(in)active_label_text_color
Support both active and inactive colors for titlebar text
This commit is contained in:
parent
606b6d946e
commit
597650b457
5 changed files with 37 additions and 9 deletions
|
|
@ -37,10 +37,16 @@ A theme consists of a themerc file and optionally some xbm icons.
|
|||
Border color of active window
|
||||
|
||||
*window.active.title.bg.color*
|
||||
Background for the focussed window's titlebar
|
||||
Background color for the focussed window's titlebar
|
||||
|
||||
*window.inactive.title.bg.color*
|
||||
Background for non-focussed windows' titlebars
|
||||
Background color for non-focussed windows' titlebars
|
||||
|
||||
*window.active.label.text.color*
|
||||
Text color for the focussed window's titlebar
|
||||
|
||||
*window.inactive.label.text.color*
|
||||
Text color non-focussed windows' titlebars
|
||||
|
||||
*window.active.button.unpressed.image.color*
|
||||
Color of the images in titlebar buttons in their default, unpressed,
|
||||
|
|
|
|||
|
|
@ -236,7 +236,12 @@ struct view {
|
|||
struct wl_list parts;
|
||||
struct wlr_box box; /* remember geo so we know when to update */
|
||||
} ssd;
|
||||
struct wlr_texture *title;
|
||||
|
||||
/* The title is unique to each view, so we store these here */
|
||||
struct {
|
||||
struct wlr_texture *active;
|
||||
struct wlr_texture *inactive;
|
||||
} title;
|
||||
|
||||
struct wlr_foreign_toplevel_handle_v1 *toplevel_handle;
|
||||
struct wl_listener toplevel_handle_request_maximize;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ struct theme {
|
|||
float window_active_title_bg_color[4];
|
||||
float window_inactive_title_bg_color[4];
|
||||
|
||||
float window_active_label_text_color[4];
|
||||
float window_inactive_label_text_color[4];
|
||||
|
||||
/* buttons */
|
||||
float window_active_button_iconify_unpressed_image_color[4];
|
||||
float window_active_button_max_unpressed_image_color[4];
|
||||
|
|
|
|||
16
src/ssd.c
16
src/ssd.c
|
|
@ -1,3 +1,4 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Helpers for view server side decorations
|
||||
*
|
||||
|
|
@ -173,7 +174,7 @@ ssd_visible_box(struct view *view, enum ssd_part_type type)
|
|||
break;
|
||||
case LAB_SSD_PART_TITLE:
|
||||
box = ssd_box(view, type);
|
||||
center_vertically(&box, view->title);
|
||||
center_vertically(&box, view->title.active);
|
||||
break;
|
||||
case LAB_SSD_PART_CORNER_TOP_LEFT:
|
||||
box = ssd_box(view, type);
|
||||
|
|
@ -286,10 +287,13 @@ ssd_update_title(struct view *view)
|
|||
|
||||
int max_width = part->box.width > 0 ? part->box.width : 1000;
|
||||
|
||||
/* TODO: use window.active.label.text.color here */
|
||||
font_texture_create(view->server, &view->title, max_width,
|
||||
font_texture_create(view->server, &view->title.active, max_width,
|
||||
view->impl->get_string_prop(view, "title"),
|
||||
&font, theme->menu_items_active_text_color);
|
||||
&font, theme->window_active_label_text_color);
|
||||
|
||||
font_texture_create(view->server, &view->title.inactive, max_width,
|
||||
view->impl->get_string_prop(view, "title"),
|
||||
&font, theme->window_inactive_label_text_color);
|
||||
|
||||
part->box = ssd_visible_box(view, part->type);
|
||||
}
|
||||
|
|
@ -340,8 +344,8 @@ ssd_create(struct view *view)
|
|||
/* title text */
|
||||
part = add_part(view, LAB_SSD_PART_TITLE);
|
||||
ssd_update_title(view);
|
||||
part->texture.active = &view->title;
|
||||
part->texture.inactive = &view->title;
|
||||
part->texture.active = &view->title.active;
|
||||
part->texture.inactive = &view->title.inactive;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
10
src/theme.c
10
src/theme.c
|
|
@ -85,6 +85,9 @@ theme_builtin(struct theme *theme)
|
|||
parse_hexstr("#dddad6", theme->window_active_title_bg_color);
|
||||
parse_hexstr("#f6f5f4", theme->window_inactive_title_bg_color);
|
||||
|
||||
parse_hexstr("#000000", theme->window_active_label_text_color);
|
||||
parse_hexstr("#000000", theme->window_inactive_label_text_color);
|
||||
|
||||
parse_hexstr("#000000",
|
||||
theme->window_active_button_iconify_unpressed_image_color);
|
||||
parse_hexstr("#000000",
|
||||
|
|
@ -154,6 +157,13 @@ entry(struct theme *theme, const char *key, const char *value)
|
|||
parse_hexstr(value, theme->window_inactive_title_bg_color);
|
||||
}
|
||||
|
||||
if (match(key, "window.active.label.text.color")) {
|
||||
parse_hexstr(value, theme->window_active_label_text_color);
|
||||
}
|
||||
if (match(key, "window.inactive.lable.text.color")) {
|
||||
parse_hexstr(value, theme->window_inactive_label_text_color);
|
||||
}
|
||||
|
||||
/* universal button */
|
||||
if (match(key, "window.active.button.unpressed.image.color")) {
|
||||
parse_hexstr(value,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue