diff --git a/data/themes/labwc-default/openbox-3/themerc b/data/themes/labwc-default/openbox-3/themerc index c698a50d..1a1c033c 100644 --- a/data/themes/labwc-default/openbox-3/themerc +++ b/data/themes/labwc-default/openbox-3/themerc @@ -2,3 +2,6 @@ window.active.title.bg.color: #589bda window.active.handle.bg.color: #3c7cb7 window.inactive.title.bg.color: #efece6 + +window.active.button.unpressed.image.color = #ffffff + diff --git a/src/theme/theme.c b/src/theme/theme.c index 9a016707..d4ddd536 100644 --- a/src/theme/theme.c +++ b/src/theme/theme.c @@ -91,6 +91,24 @@ static void process_line(char *line) entry(key, value); } +/* + * We generally use Openbox defaults, but if no theme file can be found it's + * better to populate the theme variables with some sane values as no-one + * wants to use openbox without a theme - it'll all just be black and white. + * + * Openbox doesn't actual start if it can't find a theme. As it's normally + * packaged with Clearlooks, this is not a problem, but for labwc I thought + * this was a bit hard-line. People might want to try labwc without having + * Openbox (and associated themes) installed. + */ +void theme_builtin(void) +{ + parse_hexstr("#589bda", theme.window_active_title_bg_color); + parse_hexstr("#3c7cb7", theme.window_active_handle_bg_color); + parse_hexstr("#efece6", theme.window_inactive_title_bg_color); + parse_hexstr("#ffffff", theme.window_active_button_unpressed_image_color); +} + void theme_read(const char *theme_name) { FILE *stream; @@ -102,7 +120,8 @@ void theme_read(const char *theme_name) info("reading themerc (%s)", themerc); stream = fopen(themerc, "r"); if (!stream) { - warn("cannot read (%s)", themerc); + warn("cannot read (%s) - load built-in theme", themerc); + theme_builtin(); return; } while (getline(&line, &len, stream) != -1) { diff --git a/src/theme/xbm/xbm.c b/src/theme/xbm/xbm.c index d1b2969b..85a68826 100644 --- a/src/theme/xbm/xbm.c +++ b/src/theme/xbm/xbm.c @@ -69,6 +69,7 @@ out: *texture = texture_from_builtin(renderer, button); } +/* clang-format off */ void xbm_load(struct wlr_renderer *r) { parse_set_color(theme.window_active_button_unpressed_image_color); @@ -76,3 +77,4 @@ void xbm_load(struct wlr_renderer *r) load_button(r, "max.xbm", &theme.xbm_maximize, max_button_normal); load_button(r, "iconify.xbm", &theme.xbm_iconify, iconify_button_normal); } +/* clang-format on */