]> git.mdlowis.com Git - proto/labwc.git/commitdiff
theme: use 'labwc' directory
authorJohan Malm <jgm323@gmail.com>
Thu, 2 Jan 2025 20:40:41 +0000 (20:40 +0000)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 6 Jan 2025 20:15:26 +0000 (20:15 +0000)
as well as 'openbox-3', for example: /usr/share/themes/foo/labwc/themerc

Give 'labwc' higher precedence than 'openbox-3' if both exist.

For several reasons not all themes designed for labwc render well on
Openbox:

1. Labwc support some features like SVG/PNG icons and #rrggbbaa color
   definitions which Openbox does not.

2. Openbox generally defaults to black/white colors and will not render
   themes accurate without certain options specified in themerc. For
   example, in Openbox the following will just render as black:

       window.active.title.bg.color: #589bda

   ...because Openbox defaults the texture to "Gradient Vertical" and
   therefore either needs:

      window.active.title.bg.colorTo: #3c7cb7

   ...or remove 'Gradient' from the bg definition and just use something
   like:

      window.active.title.bg: Flat Border

Whilst none of this is a problem when using labwc, it causes problems for
setups with both Openbox and labwc because themes designed for labwc only
will now show up in obconf, lxappearance, etc causing confusion for users.

README.md
docs/labwc-theme.5.scd
include/theme.h
src/common/dir.c
src/theme.c

index 9aff6c036730fe2b3a054198adf51c5ceb637b90..ce98e7fd560933f6cabe5931000a68a9d03e8dd0 100644 (file)
--- 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/\<theme-name\>/openbox-3/` or
+Themes are located at `~/.local/share/themes/\<theme-name\>/labwc/` or
 equivalent `XDG_DATA_{DIRS,HOME}` location in accordance with freedesktop XDG
 directory specification.
 
index 16cb390f8bec4c2b8ef2ee0b576600715606e849..9ce8a0a8ea45a8cb4f3f07759b0338232f7364f7 100644 (file)
@@ -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/<theme-name>/labwc/
+- $HOME/.themes/<theme-name>/labwc/
+- /usr/share/themes/<theme-name>/labwc/
+- /usr/local/share/themes/<theme-name>/labwc/
+- /opt/share/themes/<theme-name>/labwc/
 - ${XDG_DATA_HOME:-$HOME/.local/share}/themes/<theme-name>/openbox-3/
 - $HOME/.themes/<theme-name>/openbox-3/
 - /usr/share/themes/<theme-name>/openbox-3/
index 88b43e28b376743c47f311cd55af5465bc0e582c..c6893ea23f8e35b8573ec74a9f74a3b8185e00e7 100644 (file)
@@ -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 <theme-dir>/<theme-name>/openbox-3/themerc
+ * @theme_name: theme-name in <theme-dir>/<theme-name>/labwc/themerc
  * Note <theme-dir> is obtained in theme-dir.c
  */
 void theme_init(struct theme *theme, struct server *server, const char *theme_name);
index 201c9b0339825e988801cf7b53737299c96d4916..2b0016d7309a8b2a7abfccd07185dc72f6c42827 100644 (file)
@@ -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
index 0d0938a38ddb286916e17903b4ce20c191be70b1..d2cb9826ec42d8f09bd11e047be3b0178354bcc5 100644 (file)
@@ -1496,7 +1496,11 @@ theme_init(struct theme *theme, struct server *server, const char *theme_name)
         */
        theme_builtin(theme, server);
 
-       /* Read <data-dir>/share/themes/$theme_name/openbox-3/themerc */
+       /*
+        * Read
+        *   - <data-dir>/share/themes/$theme_name/labwc/themerc
+        *   - <data-dir>/share/themes/$theme_name/openbox-3/themerc
+        */
        struct wl_list paths;
        paths_theme_create(&paths, theme_name, "themerc");
        theme_read(theme, &paths);