diff --git a/README.md b/README.md index b6daa2f9..828e124a 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ For a step-by-step initial configuration guide, see [getting-started]. ## 4. Theming -Themes are located at `~/.local/share/themes/\/openbox-3/` or +Themes are located at `~/.local/share/themes/\/labwc/` or equivalent `XDG_DATA_{DIRS,HOME}` location in accordance with freedesktop XDG directory specification. diff --git a/docs/labwc-theme.5.scd b/docs/labwc-theme.5.scd index 16cb390f..9ce8a0a8 100644 --- a/docs/labwc-theme.5.scd +++ b/docs/labwc-theme.5.scd @@ -9,6 +9,11 @@ labwc - theme files The theme engine aims to be compatible with openbox and themes will be searched for in the following order: +- ${XDG_DATA_HOME:-$HOME/.local/share}/themes//labwc/ +- $HOME/.themes//labwc/ +- /usr/share/themes//labwc/ +- /usr/local/share/themes//labwc/ +- /opt/share/themes//labwc/ - ${XDG_DATA_HOME:-$HOME/.local/share}/themes//openbox-3/ - $HOME/.themes//openbox-3/ - /usr/share/themes//openbox-3/ diff --git a/include/theme.h b/include/theme.h index 88b43e28..c6893ea2 100644 --- a/include/theme.h +++ b/include/theme.h @@ -163,7 +163,7 @@ struct server; * theme_init - read openbox theme and generate button textures * @theme: theme data * @server: server - * @theme_name: theme-name in //openbox-3/themerc + * @theme_name: theme-name in //labwc/themerc * Note is obtained in theme-dir.c */ void theme_init(struct theme *theme, struct server *server, const char *theme_name); diff --git a/src/common/dir.c b/src/common/dir.c index 201c9b03..2b0016d7 100644 --- a/src/common/dir.c +++ b/src/common/dir.c @@ -75,7 +75,15 @@ build_config_path(struct ctx *ctx, char *prefix, const char *path) } static void -build_theme_path(struct ctx *ctx, char *prefix, const char *path) +build_theme_path_labwc(struct ctx *ctx, char *prefix, const char *path) +{ + assert(prefix); + snprintf(ctx->buf, ctx->len, "%s/%s/%s/labwc/%s", prefix, path, + ctx->theme_name, ctx->filename); +} + +static void +build_theme_path_openbox(struct ctx *ctx, char *prefix, const char *path) { assert(prefix); snprintf(ctx->buf, ctx->len, "%s/%s/%s/openbox-3/%s", prefix, path, @@ -169,7 +177,7 @@ paths_theme_create(struct wl_list *paths, const char *theme_name, static char buf[4096] = { 0 }; wl_list_init(paths); struct ctx ctx = { - .build_path_fn = build_theme_path, + .build_path_fn = build_theme_path_labwc, .filename = filename, .buf = buf, .len = sizeof(buf), @@ -178,6 +186,9 @@ paths_theme_create(struct wl_list *paths, const char *theme_name, .list = paths, }; find_dir(&ctx); + + ctx.build_path_fn = build_theme_path_openbox; + find_dir(&ctx); } void diff --git a/src/theme.c b/src/theme.c index 8b88baf3..6b71b59c 100644 --- a/src/theme.c +++ b/src/theme.c @@ -1496,7 +1496,11 @@ theme_init(struct theme *theme, struct server *server, const char *theme_name) */ theme_builtin(theme, server); - /* Read /share/themes/$theme_name/openbox-3/themerc */ + /* + * Read + * - /share/themes/$theme_name/labwc/themerc + * - /share/themes/$theme_name/openbox-3/themerc + */ struct wl_list paths; paths_theme_create(&paths, theme_name, "themerc"); theme_read(theme, &paths);