kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=17f29731f0f83aaf4cfe37cd55aea0fa278fee6d

commit 17f29731f0f83aaf4cfe37cd55aea0fa278fee6d
Author: Kim Woelders <[email protected]>
Date:   Sat Dec 15 20:20:49 2018 +0100

    Enable changing only theme variant
    
    Use e.g.
    $ e16 -t :variant
    $ eesh theme use :variant
---
 src/theme.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/theme.c b/src/theme.c
index e6e81658..28bb9adf 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -339,7 +339,8 @@ ThemePathFind(const char *theme)
 void
 ThemeFind(const char *theme)
 {
-   char                name[FILEPATH_LEN_MAX];
+   char                name[2048];
+   char                namx[FILEPATH_LEN_MAX];
    const char         *p;
    char               *path, *s;
 
@@ -347,17 +348,16 @@ ThemeFind(const char *theme)
       Eprintf("%s: %s\n", __func__, theme);
 
    name[0] = '\0';
-   p = (theme) ? theme : Conf.theme.name;
+   p = (theme && *theme != ':') ? theme : Conf.theme.name;
    if (p)
       snprintf(name, sizeof(name), "%s", p);
 
    s = strchr(name, ':');
    if (s)
-     {
-       *s++ = '\0';
-       Efree(Mode.theme.variant);
-       Mode.theme.variant = Estrdup(s);
-     }
+      *s++ = '\0';
+
+   p = (theme && *theme == ':') ? theme + 1 : s;
+   _EFDUP(Mode.theme.variant, p);
 
    path = ThemePathFind(name);
 
@@ -375,7 +375,14 @@ ThemeFind(const char *theme)
        if (isfile(theme))
           Conf.theme.name = ThemePathName(path);
        else
-          Conf.theme.name = Estrdup(theme);
+         {
+            s = namx;
+            if (Mode.theme.variant)
+               snprintf(namx, sizeof(namx), "%s:%s", name, Mode.theme.variant);
+            else
+               s = name;
+            Conf.theme.name = Estrdup(s);
+         }
      }
 
    Efree(Mode.theme.path);

-- 


Reply via email to