theme: add option window.button.hover.bg.color

This commit is contained in:
Johan Malm 2026-02-05 20:52:53 +00:00 committed by Johan Malm
parent 4f8b80700e
commit 54554f43dd
4 changed files with 24 additions and 5 deletions

View file

@ -173,6 +173,18 @@ window.*.title.bg.colorTo.splitTo: #557485
Space between titlebar buttons, in pixels.
Default is 0.
Note: The *window.button.hover* namespace (below) relates to button hover
overlay effects which work with all buttons including svg, png and xbm.
Openbox only supports hover effects rendered behind buttons which makes sense
for the xbm format, but not for others. For reference, these are defined by
*window.active|inactive.button.STATE.bg* where *STATE* can be any of *pressed*,
*hover* and *disabled*. These are not (yet) supported by labwc and are mentioned
here for comparison only.
*window.button.hover.bg.color*
Color of the hover effect of a titlebar button. Default is #80808020.
*window.button.hover.bg.corner-radius*
Radius of the hover effect of a titlebar button, in pixels.
Default is 0.

View file

@ -44,7 +44,8 @@ window.button.width: 26
window.button.height: 26
window.button.spacing: 0
# window button hover effect
# window button hover overlay
window.button.hover.bg.color: #80808020
window.button.hover.bg.corner-radius: 0
# window buttons

View file

@ -78,7 +78,8 @@ struct theme {
int window_button_height;
int window_button_spacing;
/* the corner radius of the hover effect */
/* button hover effect */
float window_button_hover_bg_color[4];
int window_button_hover_bg_corner_radius;
/*

View file

@ -76,9 +76,7 @@ zdrop(struct lab_data_buffer **buffer)
static void
draw_hover_overlay_on_button(cairo_t *cairo, int w, int h)
{
/* Overlay (pre-multiplied alpha) */
float overlay_color[4] = { 0.15f, 0.15f, 0.15f, 0.3f};
set_cairo_color(cairo, overlay_color);
set_cairo_color(cairo, rc.theme->window_button_hover_bg_color);
int r = rc.theme->window_button_hover_bg_corner_radius;
cairo_new_sub_path(cairo);
@ -560,6 +558,8 @@ theme_builtin(struct theme *theme, struct server *server)
theme->window_button_width = 26;
theme->window_button_height = 26;
theme->window_button_spacing = 0;
parse_hexstr("#80808020", theme->window_button_hover_bg_color);
theme->window_button_hover_bg_corner_radius = 0;
for (enum lab_node_type type = LAB_NODE_BUTTON_FIRST;
@ -787,6 +787,11 @@ entry(struct theme *theme, const char *key, const char *value)
theme->window_button_spacing = get_int_if_positive(
value, "window.button.spacing");
}
/* botton hover overlay */
if (match_glob(key, "window.button.hover.bg.color")) {
parse_color(value, theme->window_button_hover_bg_color);
}
if (match_glob(key, "window.button.hover.bg.corner-radius")) {
theme->window_button_hover_bg_corner_radius = get_int_if_positive(
value, "window.button.hover.bg.corner-radius");