diff --git a/src/common/detectGTK.c b/src/common/detectGTK.c index 8e356a2dd..b3789ac7a 100644 --- a/src/common/detectGTK.c +++ b/src/common/detectGTK.c @@ -83,11 +83,11 @@ static void detectGTKFromConfigFile(const char* filename, FFGTKResult* result) while(getline(&line, &len, file) != -1) { if(result->theme.length == 0) - ffGetPropValue(line, "gtk-theme-name=", &result->theme); + ffGetPropValue(line, "gtk-theme-name =", &result->theme); if(result->icons.length == 0) - ffGetPropValue(line, "gtk-icon-theme-name=", &result->icons); + ffGetPropValue(line, "gtk-icon-theme-name =", &result->icons); if(result->font.length == 0) - ffGetPropValue(line, "gtk-font-name=", &result->font); + ffGetPropValue(line, "gtk-font-name =", &result->font); } if(line != NULL) diff --git a/src/common/detectPlasma.c b/src/common/detectPlasma.c index b0ad9e5dd..e1b3b5bf3 100644 --- a/src/common/detectPlasma.c +++ b/src/common/detectPlasma.c @@ -42,13 +42,13 @@ static bool detectFromConfigFile(const FFstrbuf* filename, FFPlasmaResult* resul } if(category == PLASMA_CATEGORY_KDE) - ffGetPropValue(line, "widgetStyle=", &result->widgetStyle); + ffGetPropValue(line, "widgetStyle =", &result->widgetStyle); else if(category == PLASMA_CATEGORY_ICONS) - ffGetPropValue(line, "Theme=", &result->icons); + ffGetPropValue(line, "Theme =", &result->icons); else if(category == PLASMA_CATEGORY_GENERAL) { - ffGetPropValue(line, "ColorScheme=", &result->colorScheme); - ffGetPropValue(line, "font=", &result->font); + ffGetPropValue(line, "ColorScheme =", &result->colorScheme); + ffGetPropValue(line, "font =", &result->font); } } diff --git a/src/common/detectWMDE.c b/src/common/detectWMDE.c index d02b8b718..5d85a42a1 100644 --- a/src/common/detectWMDE.c +++ b/src/common/detectWMDE.c @@ -212,21 +212,21 @@ static void getKDE(FFWMDEResult* result) { ffStrbufSetS(&result->deProcessName, "plasmashell"); ffStrbufSetS(&result->dePrettyName, "KDE Plasma"); - ffParsePropFile("/usr/share/xsessions/plasma.desktop", "X-KDE-PluginInfo-Version=", &result->deVersion); + ffParsePropFile("/usr/share/xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); } static void getGnome(FFWMDEResult* result) { ffStrbufSetS(&result->deProcessName, "gnome-shell"); ffStrbufSetS(&result->dePrettyName, "GNOME"); - ffParsePropFile("/usr/share/gnome-shell/org.gnome.Extensions", "version: ", &result->deVersion); + ffParsePropFile("/usr/share/gnome-shell/org.gnome.Extensions", "version :", &result->deVersion); } static void getCinnamon(FFWMDEResult* result) { ffStrbufSetS(&result->deProcessName, "cinnamon"); ffStrbufSetS(&result->dePrettyName, "Cinnamon"); - ffParsePropFile("/usr/share/applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version=", &result->deVersion); + ffParsePropFile("/usr/share/applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", &result->deVersion); } static void getMate(FFinstance* instance, FFWMDEResult* result) @@ -261,7 +261,7 @@ static void getXFCE4(FFinstance* instance, FFWMDEResult* result) { ffStrbufSetS(&result->deProcessName, "xfce4-session"); ffStrbufSetS(&result->dePrettyName, "Xfce4"); - ffParsePropFile("/usr/share/gtk-doc/html/libxfce4ui/index.html", "
Version ", &result->deVersion); + ffParsePropFile("/usr/share/gtk-doc/html/libxfce4ui/index.html", "
Version", &result->deVersion); if(result->deVersion.length == 0 && instance->config.allowSlowOperations) { diff --git a/src/common/parsing.c b/src/common/parsing.c index acd8ce7e8..adf3d1d7a 100644 --- a/src/common/parsing.c +++ b/src/common/parsing.c @@ -118,7 +118,7 @@ bool ffGetPropValue(const char* line, const char* start, FFstrbuf* buffer) while(start[startIndex] != '\0') { - // Any amount of whitespace in the format string matches any amount of whitespace in the line + // Any amount of whitespace in the format string matches any amount of whitespace in the line, even none if(start[startIndex] == ' ' || start[startIndex] == '\t') { while(start[startIndex] == ' ' || start[startIndex] == '\t') @@ -137,6 +137,10 @@ bool ffGetPropValue(const char* line, const char* start, FFstrbuf* buffer) ++startIndex; } + //Skip any amount of whitespace at the begin of the value + while(line[lineIndex] == ' ' || line[lineIndex] == '\t') + ++lineIndex; + //Allow quotet values const char* quotes = NULL; if(line[lineIndex] == '"' || line[lineIndex] == '\'') @@ -146,7 +150,7 @@ bool ffGetPropValue(const char* line, const char* start, FFstrbuf* buffer) while(line[lineIndex] != '\n' && line[lineIndex] != '\0' && (quotes == NULL || *quotes != line[lineIndex])) ffStrbufAppendC(buffer, line[lineIndex++]); - ffStrbufTrim(buffer, ' '); + ffStrbufTrimRight(buffer, ' '); return true; } diff --git a/src/modules/locale.c b/src/modules/locale.c index 5d3ee6996..ce00a1319 100644 --- a/src/modules/locale.c +++ b/src/modules/locale.c @@ -28,7 +28,7 @@ void ffPrintLocale(FFinstance* instance) FFstrbuf locale; ffStrbufInit(&locale); - ffParsePropFile("/etc/locale.conf", "LANG=", &locale); + ffParsePropFile("/etc/locale.conf", "LANG =", &locale); if (locale.length == 0) getLocaleFromEnv(&locale); diff --git a/src/modules/os.c b/src/modules/os.c index ff9faf796..a638a9b9f 100644 --- a/src/modules/os.c +++ b/src/modules/os.c @@ -54,16 +54,16 @@ const FFOSResult* ffDetectOS(FFinstance* instance) // https://www.freedesktop.org/software/systemd/man/os-release.html while (getline(&line, &len, osRelease) != -1) { - ffGetPropValue(line, "NAME=", &result.name); - ffGetPropValue(line, "PRETTY_NAME=", &result.prettyName); - ffGetPropValue(line, "ID=", &result.id); - ffGetPropValue(line, "ID_LIKE=", &result.idLike); - ffGetPropValue(line, "VARIANT=", &result.variant); - ffGetPropValue(line, "VARIANT_ID=", &result.variantID); - ffGetPropValue(line, "VERSION=", &result.version); - ffGetPropValue(line, "VERSION_ID=", &result.versionID); - ffGetPropValue(line, "VERSION_CODENAME=", &result.codename); - ffGetPropValue(line, "BUILD_ID=", &result.buildID); + ffGetPropValue(line, "NAME =", &result.name); + ffGetPropValue(line, "PRETTY_NAME =", &result.prettyName); + ffGetPropValue(line, "ID =", &result.id); + ffGetPropValue(line, "ID_LIKE =", &result.idLike); + ffGetPropValue(line, "VARIANT =", &result.variant); + ffGetPropValue(line, "VARIANT_ID =", &result.variantID); + ffGetPropValue(line, "VERSION =", &result.version); + ffGetPropValue(line, "VERSION_ID =", &result.versionID); + ffGetPropValue(line, "VERSION_CODENAME =", &result.codename); + ffGetPropValue(line, "BUILD_ID =", &result.buildID); } if(line != NULL) diff --git a/src/modules/terminalfont.c b/src/modules/terminalfont.c index 4c4bc166b..94ed1ef8f 100644 --- a/src/modules/terminalfont.c +++ b/src/modules/terminalfont.c @@ -48,7 +48,7 @@ static void printKonsole(FFinstance* instance) { FFstrbuf profile; ffStrbufInit(&profile); - ffParsePropFileConfig(instance, "konsolerc", "DefaultProfile=", &profile); + ffParsePropFileConfig(instance, "konsolerc", "DefaultProfile =", &profile); if(profile.length == 0) { @@ -64,7 +64,7 @@ static void printKonsole(FFinstance* instance) FFstrbuf font; ffStrbufInit(&font); - ffParsePropFileHome(instance, profilePath.chars, "Font=", &font); + ffParsePropFileHome(instance, profilePath.chars, "Font =", &font); if(font.length == 0) ffPrintError(instance, FF_TERMFONT_MODULE_NAME, 0, &instance->config.termFontKey, &instance->config.termFontFormat, FF_TERMFONT_NUM_FORMAT_ARGS, "Couldn't find \"Font=%%[^\\n]\" in \"%s\"", profilePath.chars); @@ -118,7 +118,7 @@ static void printXCFETerminal(FFinstance* instance) FFstrbuf useSysFont; ffStrbufInit(&useSysFont); - if(!ffParsePropFileConfig(instance, "xfce4/terminal/terminalrc", "FontUseSystem=", &useSysFont)) + if(!ffParsePropFileConfig(instance, "xfce4/terminal/terminalrc", "FontUseSystem =", &useSysFont)) { ffPrintError(instance, FF_TERMFONT_MODULE_NAME, 0, &instance->config.termFontKey, &instance->config.termFontFormat, FF_TERMFONT_NUM_FORMAT_ARGS, "Couldn't open \"$XDG_CONFIG_HOME/xfce4/terminal/terminalrc\""); ffStrbufDestroy(&useSysFont); @@ -127,7 +127,7 @@ static void printXCFETerminal(FFinstance* instance) if(useSysFont.length == 0 || ffStrbufIgnCaseCompS(&useSysFont, "FALSE") == 0) { - printTerminalFontFromConfigFile(instance, "xfce4/terminal/terminalrc", "FontName="); + printTerminalFontFromConfigFile(instance, "xfce4/terminal/terminalrc", "FontName ="); ffStrbufDestroy(&useSysFont); return; } @@ -147,7 +147,7 @@ static void printTTY(FFinstance* instance) FFstrbuf font; ffStrbufInit(&font); - ffParsePropFile("/etc/vconsole.conf", "Font=", &font); + ffParsePropFile("/etc/vconsole.conf", "Font =", &font); if(font.length == 0) { @@ -178,7 +178,7 @@ void ffPrintTerminalFont(FFinstance* instance) else if(ffStrbufIgnCaseCompS(&result->exeName, "xfce4-terminal") == 0) printXCFETerminal(instance); else if(ffStrbufIgnCaseCompS(&result->exeName, "lxterminal") == 0) - printTerminalFontFromConfigFile(instance, "lxterminal/lxterminal.conf", "fontname="); + printTerminalFontFromConfigFile(instance, "lxterminal/lxterminal.conf", "fontname ="); else if(ffStrbufIgnCaseCompS(&result->exeName, "tilix") == 0) printTilixTerminal(instance); else if(ffStrbufStartsWithIgnCaseS(&result->exeName, "/dev/tty")) diff --git a/src/modules/wmtheme.c b/src/modules/wmtheme.c index 4746f64bd..8b2d76662 100644 --- a/src/modules/wmtheme.c +++ b/src/modules/wmtheme.c @@ -196,7 +196,7 @@ void ffPrintWMTheme(FFinstance* instance) } if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "KWin") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "KDE") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Plasma") == 0) - printWMThemeFromConfigFile(instance, "kwinrc", "theme=", "Breeze"); + printWMThemeFromConfigFile(instance, "kwinrc", "theme =", "Breeze"); else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Xfwm4") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Xfwm") == 0) printXFWM4(instance); else if(ffStrbufIgnCaseCompS(&result->wmPrettyName, "Mutter") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Gnome") == 0 || ffStrbufIgnCaseCompS(&result->wmPrettyName, "Ubuntu") == 0)