diff --git a/src/common/io/io.h b/src/common/io/io.h index c078b4122..c510c4e14 100644 --- a/src/common/io/io.h +++ b/src/common/io/io.h @@ -3,7 +3,7 @@ #ifndef FF_INCLUDED_common_io_io #define FF_INCLUDED_common_io_io -#include "fastfetch.h" +#include "util/FFstrbuf.h" #ifdef _WIN32 #include diff --git a/src/detection/cursor/cursor_linux.c b/src/detection/cursor/cursor_linux.c index 63507e803..ab7104dea 100644 --- a/src/detection/cursor/cursor_linux.c +++ b/src/detection/cursor/cursor_linux.c @@ -72,13 +72,13 @@ void ffDetectCursor(const FFinstance* instance, FFCursorResult* result) { const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufCompS(&wmde->wmPrettyName, "WSLg") == 0) + if(ffStrbufCompS(&wmde->wmPrettyName, FF_WM_PRETTY_WSLG) == 0) ffStrbufAppendS(&result->error, "WSLg uses native windows cursor"); - else if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, "TTY") == 0) + else if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0) ffStrbufAppendS(&result->error, "Cursor isn't supported in TTY"); - else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "KDE Plasma") == 0) + else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA) == 0) detectCursorFromConfigFile(instance, "kcminputrc", "cursorTheme =", "Breeze", "cursorSize =", "24", result); - else if(ffStrbufStartsWithIgnCaseS(&wmde->dePrettyName, "LXQt")) + else if(ffStrbufStartsWithIgnCaseS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT)) detectCursorFromConfigFile(instance, "lxqt/session.conf", "cursor_theme =", "Adwaita", "cursor_size =", "24", result); else if( !detectCursorGTK(instance, result) && diff --git a/src/detection/displayserver/displayserver.h b/src/detection/displayserver/displayserver.h index 17fef3ba5..271a35085 100644 --- a/src/detection/displayserver/displayserver.h +++ b/src/detection/displayserver/displayserver.h @@ -5,6 +5,35 @@ #include "fastfetch.h" +#define FF_DE_PRETTY_PLASMA "KDE Plasma" +#define FF_DE_PRETTY_GNOME "Gnome" +#define FF_DE_PRETTY_XFCE4 "Xfce4" +#define FF_DE_PRETTY_CINNAMON "Cinnamon" +#define FF_DE_PRETTY_MATE "Mate" +#define FF_DE_PRETTY_LXDE "LXDE" +#define FF_DE_PRETTY_LXQT "LXQT" +#define FF_DE_PRETTY_BUDGIE "Budgie" +#define FF_DE_PRETTY_UNITY "Unity" + +#define FF_WM_PRETTY_KWIN "KWin" +#define FF_WM_PRETTY_MUTTER "Mutter" +#define FF_WM_PRETTY_MUFFIN "Muffin" +#define FF_WM_PRETTY_MARCO "Marco" +#define FF_WM_PRETTY_XFWM4 "Xfwm4" +#define FF_WM_PRETTY_OPENBOX "Openbox" +#define FF_WM_PRETTY_I3 "i3" +#define FF_WM_PRETTY_WAYFIRE "Wayfire" +#define FF_WM_PRETTY_SWAY "Sway" +#define FF_WM_PRETTY_BSPWM "bspwm" +#define FF_WM_PRETTY_DWM "dwm" +#define FF_WM_PRETTY_WESTON "Weston" +#define FF_WM_PRETTY_XMONAD "XMonad" +#define FF_WM_PRETTY_WSLG "WSLg" + +#define FF_WM_PROTOCOL_TTY "TTY" +#define FF_WM_PROTOCOL_X11 "X11" +#define FF_WM_PROTOCOL_WAYLAND "Wayland" + typedef struct FFDisplayResult { uint32_t width; diff --git a/src/detection/displayserver/linux/displayserver_linux.h b/src/detection/displayserver/linux/displayserver_linux.h index 9c7588058..aee7c25ff 100644 --- a/src/detection/displayserver/linux/displayserver_linux.h +++ b/src/detection/displayserver/linux/displayserver_linux.h @@ -5,10 +5,6 @@ #include "detection/displayserver/displayserver.h" -#define FF_DISPLAYSERVER_PROTOCOL_WAYLAND "Wayland" -#define FF_DISPLAYSERVER_PROTOCOL_X11 "X11" -#define FF_DISPLAYSERVER_PROTOCOL_TTY "TTY" - void ffdsConnectWayland(const FFinstance* instance, FFDisplayServerResult* result); void ffdsConnectXcbRandr(const FFinstance* instance, FFDisplayServerResult* result); diff --git a/src/detection/displayserver/linux/wayland.c b/src/detection/displayserver/linux/wayland.c index 71dd0b07b..2b6ed5f70 100644 --- a/src/detection/displayserver/linux/wayland.c +++ b/src/detection/displayserver/linux/wayland.c @@ -156,7 +156,7 @@ bool detectWayland(const FFinstance* instance, FFDisplayServerResult* result) //We successfully connected to wayland and detected the display. //So we can set set the session type to wayland. //This is used as an indicator that we are running wayland by the x11 backends. - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND); return true; } #endif @@ -187,5 +187,5 @@ void ffdsConnectWayland(const FFinstance* instance, FFDisplayServerResult* resul //We are probably running a wayland compositor at this point, //but fastfetch was compiled without the required library, or loading the library failed. - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND); } diff --git a/src/detection/displayserver/linux/wmde.c b/src/detection/displayserver/linux/wmde.c index 779e296d9..33d03a20a 100644 --- a/src/detection/displayserver/linux/wmde.c +++ b/src/detection/displayserver/linux/wmde.c @@ -65,31 +65,33 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* proce strcasecmp(processName, "kwin_x11") == 0 || strcasecmp(processName, "kwin_x11_wrapper") == 0 || strcasecmp(processName, "kwin") == 0 - ) ffStrbufSetS(&result->wmPrettyName, "KWin"); + ) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_KWIN); else if( strcasecmp(processName, "gnome-shell") == 0 || strcasecmp(processName, "gnome shell") == 0 || strcasecmp(processName, "gnome-session-binary") == 0 || strcasecmp(processName, "Mutter") == 0 - ) ffStrbufSetS(&result->wmPrettyName, "Mutter"); + ) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUTTER); else if( strcasecmp(processName, "cinnamon-session") == 0 || strcasecmp(processName, "Muffin") == 0 - ) ffStrbufSetS(&result->wmPrettyName, "Muffin"); + ) ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MUFFIN); else if(strcasecmp(processName, "sway") == 0) - ffStrbufSetS(&result->wmPrettyName, "Sway"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_SWAY); else if(strcasecmp(processName, "weston") == 0) - ffStrbufSetS(&result->wmPrettyName, "Weston"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_WESTON); else if(strcasecmp(processName, "wayfire") == 0) - ffStrbufSetS(&result->wmPrettyName, "Wayfire"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_WAYFIRE); else if(strcasecmp(processName, "openbox") == 0) - ffStrbufSetS(&result->wmPrettyName, "Openbox"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_OPENBOX); else if(strcasecmp(processName, "xfwm4") == 0) - ffStrbufSetS(&result->wmPrettyName, "Xfwm4"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_XFWM4); else if(strcasecmp(processName, "Marco") == 0) - ffStrbufSetS(&result->wmPrettyName, "Marco"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_MARCO); else if(strcasecmp(processName, "xmonad") == 0) - ffStrbufSetS(&result->wmPrettyName, "XMonad"); + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_XMONAD); + else if(strcasecmp(processName, "WSLg") == 0) + ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_WSLG); else if( // WMs where the pretty name matches the process name strcasecmp(processName, "dwm") == 0 || strcasecmp(processName, "bspwm") == 0 || @@ -119,7 +121,7 @@ static void applyBetterWM(FFDisplayServerResult* result, const char* processName static void getKDE(const FFinstance* instance, FFDisplayServerResult* result) { ffStrbufSetS(&result->deProcessName, "plasmashell"); - ffStrbufSetS(&result->dePrettyName, "KDE Plasma"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_PLASMA); ffParsePropFileData(instance, "xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); if(result->deVersion.length == 0) @@ -135,21 +137,21 @@ static void getKDE(const FFinstance* instance, FFDisplayServerResult* result) static void getGnome(const FFinstance* instance, FFDisplayServerResult* result) { ffStrbufSetS(&result->deProcessName, "gnome-shell"); - ffStrbufSetS(&result->dePrettyName, "GNOME"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_GNOME); ffParsePropFileData(instance, "gnome-shell/org.gnome.Extensions", "version :", &result->deVersion); } static void getCinnamon(const FFinstance* instance, FFDisplayServerResult* result) { ffStrbufSetS(&result->deProcessName, "cinnamon"); - ffStrbufSetS(&result->dePrettyName, "Cinnamon"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_CINNAMON); ffParsePropFileData(instance, "applications/cinnamon.desktop", "X-GNOME-Bugzilla-Version =", &result->deVersion); } static void getMate(const FFinstance* instance, FFDisplayServerResult* result) { ffStrbufSetS(&result->deProcessName, "mate-session"); - ffStrbufSetS(&result->dePrettyName, "MATE"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_MATE); FFstrbuf major; ffStrbufInit(&major); @@ -188,7 +190,7 @@ static void getMate(const FFinstance* instance, FFDisplayServerResult* result) static void getXFCE4(const FFinstance* instance, FFDisplayServerResult* result) { ffStrbufSetS(&result->deProcessName, "xfce4-session"); - ffStrbufSetS(&result->dePrettyName, "Xfce4"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_XFCE4); ffParsePropFileData(instance, "gtk-doc/html/libxfce4ui/index.html", "

Version", &result->deVersion); if(result->deVersion.length == 0 && instance->config.allowSlowOperations) @@ -209,7 +211,7 @@ static void getXFCE4(const FFinstance* instance, FFDisplayServerResult* result) static void getLXQt(const FFinstance* instance, FFDisplayServerResult* result) { ffStrbufSetS(&result->deProcessName, "lxqt-session"); - ffStrbufSetS(&result->dePrettyName, "LXQt"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_LXQT); ffParsePropFileData(instance, "gconfig/lxqt.pc", "Version:", &result->deVersion); if(result->deVersion.length == 0) @@ -241,8 +243,8 @@ static void getLXQt(const FFinstance* instance, FFDisplayServerResult* result) static void getBudgie(const FFinstance* instance, FFDisplayServerResult* result) { - ffStrbufSetS(&result->dePrettyName, "Budgie"); ffStrbufSetS(&result->deProcessName, "budgie-desktop"); + ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_BUDGIE); ffParsePropFileData(instance, "budgie/budgie-version.xml", "", &result->deVersion); } @@ -307,9 +309,9 @@ static void getWMProtocolNameFromEnv(FFDisplayServerResult* result) if(ffStrSet(env)) { if(strcasecmp(env, "x11") == 0) - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_X11); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); else if(strcasecmp(env, "tty") == 0) - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_TTY); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_TTY); else ffStrbufSetS(&result->wmProtocolName, env); @@ -319,14 +321,14 @@ static void getWMProtocolNameFromEnv(FFDisplayServerResult* result) env = getenv("DISPLAY"); if(ffStrSet(env)) { - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_X11); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); return; } env = getenv("TERM"); - if(ffStrSet(env)) + if(ffStrSet(env) && strcasecmp(env, "linux") == 0) { - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_TTY); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_TTY); return; } } @@ -408,7 +410,7 @@ void ffdsDetectWMDE(const FFinstance* instance, FFDisplayServerResult* result) //We don't want to detect anything in TTY //This can't happen if a connection succeeded, so we don't need to clear wmProcessName - if(ffStrbufIgnCaseCompS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_TTY) == 0) + if(ffStrbufIgnCaseCompS(&result->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0) return; const char* env = parseEnv(); diff --git a/src/detection/displayserver/linux/xcb.c b/src/detection/displayserver/linux/xcb.c index 99a960894..0909d0b76 100644 --- a/src/detection/displayserver/linux/xcb.c +++ b/src/detection/displayserver/linux/xcb.c @@ -62,7 +62,7 @@ static void* xcbGetProperty(XcbPropertyData* data, xcb_connection_t* connection, static void xcbDetectWMfromEWMH(XcbPropertyData* data, xcb_connection_t* connection, xcb_window_t rootWindow, FFDisplayServerResult* result) { - if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND) == 0) + if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND) == 0) return; xcb_window_t* wmWindow = (xcb_window_t*) xcbGetProperty(data, connection, rootWindow, "_NET_SUPPORTING_WM_CHECK"); @@ -131,7 +131,7 @@ void ffdsConnectXcb(const FFinstance* instance, FFDisplayServerResult* result) //If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland. if(result->wmProtocolName.length == 0) - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_X11); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); } #else @@ -391,7 +391,7 @@ void ffdsConnectXcbRandr(const FFinstance* instance, FFDisplayServerResult* resu //If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland. if(result->wmProtocolName.length == 0) - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_X11); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); } #else diff --git a/src/detection/displayserver/linux/xlib.c b/src/detection/displayserver/linux/xlib.c index 12f87587c..e6fb8b930 100644 --- a/src/detection/displayserver/linux/xlib.c +++ b/src/detection/displayserver/linux/xlib.c @@ -39,7 +39,7 @@ static unsigned char* x11GetProperty(X11PropertyData* data, Display* display, Wi static void x11DetectWMFromEWMH(X11PropertyData* data, Display* display, FFDisplayServerResult* result) { - if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_WAYLAND) == 0) + if(result->wmProcessName.length > 0 || ffStrbufCompS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND) == 0) return; Window* wmWindow = (Window*) x11GetProperty(data, display, DefaultRootWindow(display), "_NET_SUPPORTING_WM_CHECK"); @@ -94,7 +94,7 @@ void ffdsConnectXlib(const FFinstance* instance, FFDisplayServerResult* result) //If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland. if(result->wmProtocolName.length == 0) - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_X11); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); } #else @@ -315,7 +315,7 @@ void ffdsConnectXrandr(const FFinstance* instance, FFDisplayServerResult* result //If wayland hasn't set this, connection failed for it. So we are running only a X Server, not XWayland. if(result->wmProtocolName.length == 0) - ffStrbufSetS(&result->wmProtocolName, FF_DISPLAYSERVER_PROTOCOL_X11); + ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_X11); } #else diff --git a/src/detection/gtk.c b/src/detection/gtk.c index 1db344edd..3fb9b8e7c 100644 --- a/src/detection/gtk.c +++ b/src/detection/gtk.c @@ -56,7 +56,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Xfce") == 0 || ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Xfce4") == 0) + if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_XFCE4) == 0) { themeName = ffSettingsGetXFConf(instance, "xsettings", "/Net/ThemeName", FF_VARIANT_TYPE_STRING).strValue; iconsName = ffSettingsGetXFConf(instance, "xsettings", "/Net/IconThemeName", FF_VARIANT_TYPE_STRING).strValue; @@ -64,7 +64,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul cursorTheme = ffSettingsGetXFConf(instance, "xsettings", "/Gtk/CursorThemeName", FF_VARIANT_TYPE_STRING).strValue; cursorSize = ffSettingsGetXFConf(instance, "xsettings", "/Gtk/CursorThemeSize", FF_VARIANT_TYPE_INT).intValue; } - else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Cinnamon") == 0) + else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_CINNAMON) == 0) { themeName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/gtk-theme", "org.cinnamon.desktop.interface", NULL, "gtk-theme", FF_VARIANT_TYPE_STRING).strValue; iconsName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/icon-theme", "org.cinnamon.desktop.interface", NULL, "icon-theme", FF_VARIANT_TYPE_STRING).strValue; @@ -72,7 +72,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul cursorTheme = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/cursor-theme", "org.cinnamon.desktop.interface", NULL, "cursor-theme", FF_VARIANT_TYPE_STRING).strValue; cursorSize = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/cursor-size", "org.cinnamon.desktop.interface", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue; } - else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Mate") == 0) + else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_MATE) == 0) { themeName = ffSettingsGet(instance, "/org/mate/interface/gtk-theme", "org.mate.interface", NULL, "gtk-theme", FF_VARIANT_TYPE_STRING).strValue; iconsName = ffSettingsGet(instance, "/org/mate/interface/icon-theme", "org.mate.interface", NULL, "icon-theme", FF_VARIANT_TYPE_STRING).strValue; @@ -81,9 +81,9 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul cursorSize = ffSettingsGet(instance, "/org/mate/peripherals-mouse/cursor-size", "org.mate.peripherals-mouse", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue; } else if( - ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Gnome") == 0 || - ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Unity") == 0 || - ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Budgie") == 0 + ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_GNOME) == 0 || + ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_UNITY) == 0 || + ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_BUDGIE) == 0 ) { themeName = ffSettingsGet(instance, "/org/gnome/desktop/interface/gtk-theme", "org.gnome.desktop.interface", NULL, "gtk-theme", FF_VARIANT_TYPE_STRING).strValue; iconsName = ffSettingsGet(instance, "/org/gnome/desktop/interface/icon-theme", "org.gnome.desktop.interface", NULL, "icon-theme", FF_VARIANT_TYPE_STRING).strValue; diff --git a/src/detection/qt.c b/src/detection/qt.c index 5ac1d943e..649a2a25b 100644 --- a/src/detection/qt.c +++ b/src/detection/qt.c @@ -152,9 +152,9 @@ const FFQtResult* ffDetectQt(const FFinstance* instance) const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "KDE Plasma") == 0) + if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA) == 0) detectPlasma(instance, &result); - else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "LXQt") == 0) + else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT) == 0) detectLXQt(instance, &result); ffThreadMutexUnlock(&mutex); diff --git a/src/detection/wmtheme/wmtheme_linux.c b/src/detection/wmtheme/wmtheme_linux.c index 6efba12c5..d87757567 100644 --- a/src/detection/wmtheme/wmtheme_linux.c +++ b/src/detection/wmtheme/wmtheme_linux.c @@ -200,27 +200,27 @@ bool ffDetectWmTheme(FFinstance* instance, FFstrbuf* themeOrError) return false; } - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "KWin") == 0 || ffStrbufIgnCaseCompS(&wm->wmPrettyName, "KDE") == 0 || ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Plasma") == 0) + if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, FF_WM_PRETTY_KWIN) == 0) return detectWMThemeFromConfigFile(instance, "kwinrc", "theme =", "Breeze", themeOrError); - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Xfwm4") == 0 || ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Xfwm") == 0) + if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, FF_WM_PRETTY_XFWM4) == 0) return detectXFWM4(instance, themeOrError); - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Mutter") == 0) + if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, FF_WM_PRETTY_MUTTER) == 0) { - if(ffStrbufIgnCaseCompS(&wm->dePrettyName, "Gnome") == 0) + if(ffStrbufIgnCaseCompS(&wm->dePrettyName, FF_DE_PRETTY_GNOME) == 0) return detectMutter(instance, themeOrError); else return detectGTKThemeAsWMTheme(instance, themeOrError); } - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Muffin") == 0) + if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, FF_WM_PRETTY_MUFFIN) == 0) return detectMuffin(instance, themeOrError); - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Marco") == 0) + if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, FF_WM_PRETTY_MARCO) == 0) return detectWMThemeFromSettings(instance, "/org/mate/Marco/general/theme", "org.mate.Marco.general", NULL, "theme", themeOrError); - if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, "Openbox") == 0) + if(ffStrbufIgnCaseCompS(&wm->wmPrettyName, FF_WM_PRETTY_OPENBOX) == 0) return detectOpenbox(instance, &wm->dePrettyName, themeOrError); ffStrbufAppendS(themeOrError, "Unknown WM: "); diff --git a/src/modules/font.c b/src/modules/font.c index 0b2e05e16..29d3fac15 100644 --- a/src/modules/font.c +++ b/src/modules/font.c @@ -77,7 +77,7 @@ void ffPrintFont(FFinstance* instance) const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, "TTY") == 0) + if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0) { ffPrintError(instance, FF_FONT_MODULE_NAME, 0, &instance->config.font, "Font isn't supported in TTY"); return; diff --git a/src/modules/icons.c b/src/modules/icons.c index 4597cf2e8..bb12ecc81 100644 --- a/src/modules/icons.c +++ b/src/modules/icons.c @@ -20,7 +20,7 @@ void ffPrintIcons(FFinstance* instance) const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, "TTY") == 0) + if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0) { ffPrintError(instance, FF_ICONS_MODULE_NAME, 0, &instance->config.icons, "Icons aren't supported in TTY"); return; diff --git a/src/modules/theme.c b/src/modules/theme.c index 5c10ee485..1dc7c868a 100644 --- a/src/modules/theme.c +++ b/src/modules/theme.c @@ -20,7 +20,7 @@ void ffPrintTheme(FFinstance* instance) const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, "TTY") == 0) + if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0) { ffPrintError(instance, FF_THEME_MODULE_NAME, 0, &instance->config.theme, "Theme isn't supported in TTY"); return;