From 680dee1daf2a2942bcc08bc7724ffcc52743202a Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 25 Apr 2020 14:44:23 +0100 Subject: [PATCH] efreet - work around conconforming apps putting startupwmclass in quotes riot does StartupWMClass="Riot" https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html does not allow for quoting here. you can quote fields in an exec line - for shell and replacement purposes, but not other fields like this above. this is a workaround a broken app so matching window to desktop file works. @fix --- src/lib/efreet/efreet_desktop.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lib/efreet/efreet_desktop.c b/src/lib/efreet/efreet_desktop.c index f0c46d4c33..4e97dc1efb 100644 --- a/src/lib/efreet/efreet_desktop.c +++ b/src/lib/efreet/efreet_desktop.c @@ -777,7 +777,22 @@ efreet_desktop_application_fields_parse(Efreet_Desktop *desktop, Efreet_Ini *ini if (val) desktop->path = strdup(val); val = efreet_ini_string_get(ini, "StartupWMClass"); - if (val) desktop->startup_wm_class = strdup(val); + if ((val) && (val[0]) && (val[1])) + { + size_t len = strlen(val); + if (((val[0] == '"') && (val[len - 1] == '"') ) || + ((val[0] == '\'') && (val[len - 1] == '\''))) + { + // fixup for some spec-violating apps that put startupwmclass + // in quotes... spec doesnt allow for this. just escapes. + char *tmpval = alloca(len - 1); + strncpy(tmpval, val + 1, len - 2); + tmpval[len - 2] = '\0'; + desktop->startup_wm_class = strdup(tmpval); + } + else + desktop->startup_wm_class = strdup(val); + } val = efreet_ini_string_get(ini, "Categories"); if (val)