From ea8c68bab4b84824189b3742cd43251739c7159d Mon Sep 17 00:00:00 2001 From: DarN Date: Sat, 26 Jun 2021 08:14:11 +0200 Subject: [PATCH 1/4] Sanitize custom Plasma theme name --- src/modules/wmtheme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/wmtheme.c b/src/modules/wmtheme.c index 820a9db3a..2d6a1b7f3 100644 --- a/src/modules/wmtheme.c +++ b/src/modules/wmtheme.c @@ -45,6 +45,9 @@ static void printWMThemeFromConfigFile(FFinstance* instance, const char* configF return; } + // Remove Plasma generated garbage + ffStrbufRemoveStrings(&theme, 1, "__aurorae__svg__"); + printWMTheme(instance, theme.chars); ffStrbufDestroy(&theme); } From 4c02b8319b1e60646b711a04961778fb33514b9d Mon Sep 17 00:00:00 2001 From: DarN Date: Sat, 26 Jun 2021 08:40:23 +0200 Subject: [PATCH 2/4] Comment edit --- src/modules/wmtheme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/wmtheme.c b/src/modules/wmtheme.c index 2d6a1b7f3..374225171 100644 --- a/src/modules/wmtheme.c +++ b/src/modules/wmtheme.c @@ -45,7 +45,7 @@ static void printWMThemeFromConfigFile(FFinstance* instance, const char* configF return; } - // Remove Plasma generated garbage + // Remove Plasma-generated prefix ffStrbufRemoveStrings(&theme, 1, "__aurorae__svg__"); printWMTheme(instance, theme.chars); From 3d3216ba91ed9bd88e8998c9cae7ebf0df9ab7d5 Mon Sep 17 00:00:00 2001 From: DarN Date: Sat, 26 Jun 2021 16:47:47 +0200 Subject: [PATCH 3/4] Added flexible remove logic --- src/modules/wmtheme.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/wmtheme.c b/src/modules/wmtheme.c index 374225171..ee30d45ff 100644 --- a/src/modules/wmtheme.c +++ b/src/modules/wmtheme.c @@ -45,8 +45,16 @@ static void printWMThemeFromConfigFile(FFinstance* instance, const char* configF return; } - // Remove Plasma-generated prefix - ffStrbufRemoveStrings(&theme, 1, "__aurorae__svg__"); + // Remove Plasma-generated prefixes + uint32_t idx = 0; + + idx = ffStrbufFirstIndexS(&theme, "qml_"); + if((idx != theme.length)) + ffStrbufSubstrAfter(&theme, idx + 3); + + idx = ffStrbufFirstIndexS(&theme, "svg__"); + if((idx != theme.length)) + ffStrbufSubstrAfter(&theme, idx + 4); printWMTheme(instance, theme.chars); ffStrbufDestroy(&theme); From d2156dfc1dcae255e27c5f0305690c1b2f61b4f0 Mon Sep 17 00:00:00 2001 From: DarN Date: Sat, 26 Jun 2021 16:53:43 +0200 Subject: [PATCH 4/4] Remove fluff --- src/modules/wmtheme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/wmtheme.c b/src/modules/wmtheme.c index ee30d45ff..9959d985b 100644 --- a/src/modules/wmtheme.c +++ b/src/modules/wmtheme.c @@ -49,11 +49,11 @@ static void printWMThemeFromConfigFile(FFinstance* instance, const char* configF uint32_t idx = 0; idx = ffStrbufFirstIndexS(&theme, "qml_"); - if((idx != theme.length)) + if(idx != theme.length) ffStrbufSubstrAfter(&theme, idx + 3); idx = ffStrbufFirstIndexS(&theme, "svg__"); - if((idx != theme.length)) + if(idx != theme.length) ffStrbufSubstrAfter(&theme, idx + 4); printWMTheme(instance, theme.chars);