diff --git a/docs/labwc-theme.5.scd b/docs/labwc-theme.5.scd index 31c9b35a..6f639905 100644 --- a/docs/labwc-theme.5.scd +++ b/docs/labwc-theme.5.scd @@ -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, diff --git a/include/labwc.h b/include/labwc.h index 58244999..132390a2 100644 --- a/include/labwc.h +++ b/include/labwc.h @@ -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; diff --git a/include/theme.h b/include/theme.h index 8041f94e..8f4fa24f 100644 --- a/include/theme.h +++ b/include/theme.h @@ -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]; diff --git a/src/ssd.c b/src/ssd.c index 0900fdd7..200e3f75 100644 --- a/src/ssd.c +++ b/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 diff --git a/src/theme.c b/src/theme.c index 8525a79d..c0cfdb1c 100644 --- a/src/theme.c +++ b/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,