mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
theme: set sane values if no theme found
This commit is contained in:
parent
e25118d8ec
commit
cda27da33e
3 changed files with 25 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue