From af33627c4c0fe638e96212be36ad85b08646af06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 13 Jun 2023 22:03:29 +0800 Subject: [PATCH 01/47] DisplayServer: fix typos. --- src/detection/displayserver/displayserver_apple.c | 1 - src/detection/displayserver/displayserver_windows.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/detection/displayserver/displayserver_apple.c b/src/detection/displayserver/displayserver_apple.c index f2d2447aa..8943a6a54 100644 --- a/src/detection/displayserver/displayserver_apple.c +++ b/src/detection/displayserver/displayserver_apple.c @@ -117,7 +117,6 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins ffStrbufInit(&ds->deProcessName); ffStrbufInit(&ds->dePrettyName); ffStrbufInit(&ds->deVersion); - ffStrbufInit(&ds->deProcessName); ffStrbufAppendS(&ds->dePrettyName, "Aqua"); ffListInitA(&ds->displays, sizeof(FFDisplayResult), 4); diff --git a/src/detection/displayserver/displayserver_windows.c b/src/detection/displayserver/displayserver_windows.c index 5d93746f5..73bc668f3 100644 --- a/src/detection/displayserver/displayserver_windows.c +++ b/src/detection/displayserver/displayserver_windows.c @@ -126,7 +126,7 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* ins ) ffStrbufSetS(&ds->dePrettyName, "Fluent"); else if( ffStrbufEqualS(&os->version, "8") || - ffStrbufEqualS(&os->version, "81.") || + ffStrbufEqualS(&os->version, "8.1") || ffStrbufEqualS(&os->version, "2012 R2") || ffStrbufEqualS(&os->version, "2012") ) ffStrbufSetS(&ds->dePrettyName, "Metro"); From af2e9a9a78e0884d2ef9888f5171584896ee6f05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 21:35:18 +0800 Subject: [PATCH 02/47] Logo: fix `paddingLeft` doesn't work when `paddingTop` is set --- src/logo/image/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logo/image/image.c b/src/logo/image/image.c index 9da6584fc..9c9e0d390 100644 --- a/src/logo/image/image.c +++ b/src/logo/image/image.c @@ -49,8 +49,8 @@ static bool printImageIterm(FFinstance* instance) return false; } - ffPrintCharTimes(' ', instance->config.logo.paddingLeft); ffPrintCharTimes('\n', instance->config.logo.paddingTop); + ffPrintCharTimes(' ', instance->config.logo.paddingLeft); FFstrbuf base64 = base64Encode(&buf); instance->state.logoWidth = instance->config.logo.width + instance->config.logo.paddingLeft + instance->config.logo.paddingRight; instance->state.logoHeight = instance->config.logo.paddingTop + instance->config.logo.height; From 6acfc1b715bba3b4ace80ef8c815d814229e29b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 09:53:43 +0800 Subject: [PATCH 03/47] DE: fix KDE version detection on Fedora --- src/detection/displayserver/linux/wmde.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/detection/displayserver/linux/wmde.c b/src/detection/displayserver/linux/wmde.c index db309b92a..a7ac96b8d 100644 --- a/src/detection/displayserver/linux/wmde.c +++ b/src/detection/displayserver/linux/wmde.c @@ -132,6 +132,16 @@ static void getKDE(const FFinstance* instance, FFDisplayServerResult* result) ffParsePropFileData(instance, "wayland-sessions/plasmawayland.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); if(result->deVersion.length == 0) ffParsePropFileData(instance, "wayland-sessions/plasmawayland5.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); + if(result->deVersion.length == 0) + { + if (ffProcessAppendStdOut(&result->deVersion, (char* const[]){ + "plasmashell", + "--version", + NULL + }) == NULL) // plasmashell 5.27.5 + ffStrbufSubstrAfterLastC(&result->deVersion, ' '); + } + applyBetterWM(result, getenv("KDEWM")); } From 6ba95d7017021415b097c7690f71dbc761f2972c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 12:16:54 +0800 Subject: [PATCH 04/47] Wallpaper (Linux): support KDE --- CHANGELOG.md | 5 +++++ src/detection/gtk_qt/gtk_qt.h | 1 + src/detection/gtk_qt/qt.c | 9 ++++++++- src/detection/users/users_linux.c | 4 ++-- src/detection/wallpaper/wallpaper_linux.c | 19 ++++++++++++++----- 5 files changed, 30 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b99eba1f..c2eab7f34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.11.4 + +Features: +* Support KDE wallpaper detection (Wallpaper, Linux) + # 1.11.3 Bugfixes: diff --git a/src/detection/gtk_qt/gtk_qt.h b/src/detection/gtk_qt/gtk_qt.h index 6e890fa97..8a115e5b0 100644 --- a/src/detection/gtk_qt/gtk_qt.h +++ b/src/detection/gtk_qt/gtk_qt.h @@ -21,6 +21,7 @@ typedef struct FFQtResult FFstrbuf colorScheme; FFstrbuf icons; FFstrbuf font; + FFstrbuf wallpaper; } FFQtResult; const FFGTKResult* ffDetectGTK2(const FFinstance* instance); diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index 74b54a1df..53384f8d1 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -13,7 +13,8 @@ static inline bool allValuesSet(const FFQtResult* result) result->widgetStyle.length > 0 && result->colorScheme.length > 0 && result->icons.length > 0 && - result->font.length > 0; + result->font.length > 0 && + result->wallpaper.length > 0; } typedef enum PlasmaCategory @@ -96,6 +97,11 @@ static void detectPlasma(const FFinstance* instance, FFQtResult* result) if(detectPlasmaFromFile(baseDir.chars, result)) foundAFile = true; + ffStrbufSet(&baseDir, configDir); + ffStrbufAppendS(&baseDir, "plasma-org.kde.plasma.desktop-appletsrc"); + + ffParsePropFile(baseDir.chars, "Image=", &result->wallpaper); + if(allValuesSet(result)) { ffStrbufDestroy(&baseDir); @@ -149,6 +155,7 @@ const FFQtResult* ffDetectQt(const FFinstance* instance) ffStrbufInit(&result.colorScheme); ffStrbufInit(&result.icons); ffStrbufInit(&result.font); + ffStrbufInit(&result.wallpaper); const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); diff --git a/src/detection/users/users_linux.c b/src/detection/users/users_linux.c index b1dcee8ed..421a6d5d2 100644 --- a/src/detection/users/users_linux.c +++ b/src/detection/users/users_linux.c @@ -22,9 +22,9 @@ next: if(n->ut_type != USER_PROCESS) continue; - for(uint32_t i = 0; i < users->length; ++i) + FF_LIST_FOR_EACH(FFstrbuf, user, *users) { - if(ffStrbufCompS((FFstrbuf*)ffListGet(users, i), n->ut_user) == 0) + if(ffStrbufCompS(user, n->ut_user) == 0) goto next; } diff --git a/src/detection/wallpaper/wallpaper_linux.c b/src/detection/wallpaper/wallpaper_linux.c index b1876f878..7ae5b480d 100644 --- a/src/detection/wallpaper/wallpaper_linux.c +++ b/src/detection/wallpaper/wallpaper_linux.c @@ -4,14 +4,23 @@ const char* ffDetectWallpaper(const FFinstance* instance, FFstrbuf* result) { + const FFstrbuf* wallpaper = NULL; const FFGTKResult* gtk = ffDetectGTK4(instance); - if (!gtk->wallpaper.length) + if (gtk->wallpaper.length) + wallpaper = >k->wallpaper; + else + { + const FFQtResult* qt = ffDetectQt(instance); + if (qt->wallpaper.length) + wallpaper = &qt->wallpaper; + } + + if (!wallpaper) return "Failed to detect the current wallpaper path"; - if (ffStrbufStartsWithS(>k->wallpaper, "file:///")) - ffStrbufAppendS(result, gtk->wallpaper.chars + strlen("file://")); + if (ffStrbufStartsWithS(wallpaper, "file:///")) + ffStrbufAppendS(result, wallpaper->chars + strlen("file://")); else - ffStrbufAppend(result, >k->wallpaper); - + ffStrbufAppend(result, wallpaper); return NULL; } From d23831465aafaae22a8942094694415e77646bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 12:19:40 +0800 Subject: [PATCH 05/47] Terminal: support qterminal version detection --- src/detection/terminalshell/terminalshell.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 3117f6cb5..00aa1bc6e 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -258,6 +258,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufIgnCaseEqualS(processName, "foot")) return getTerminalVersionFoot(exe, version); + if(ffStrbufIgnCaseEqualS(processName, "qterminal")) + return getExeVersionRaw(exe, version); //1.2.0 + #endif #ifdef _WIN32 From 0486ad8da7dfabe704b58078d939584b6d8a26a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 12:31:50 +0800 Subject: [PATCH 06/47] TerminalFont (Linux): support QTerminal --- CHANGELOG.md | 1 + README.md | 2 +- .../terminalfont/terminalfont_linux.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2eab7f34..b0ea958d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Features: * Support KDE wallpaper detection (Wallpaper, Linux) +* Support QTerminal version & terminal font detection # 1.11.3 diff --git a/README.md b/README.md index ef9536c06..996b328ba 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Budgie, Cinnamon, Gnome, KDE Plasma, LXQt, Mate, XFCE4 ##### Terminal fonts ``` -Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, mintty, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal +Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, mintty, QTerminal, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal ``` ## Building diff --git a/src/detection/terminalfont/terminalfont_linux.c b/src/detection/terminalfont/terminalfont_linux.c index 9742a6daa..28565fefa 100644 --- a/src/detection/terminalfont/terminalfont_linux.c +++ b/src/detection/terminalfont/terminalfont_linux.c @@ -221,6 +221,23 @@ static void detectFootTerminal(const FFinstance* instance, FFTerminalFontResult* ffFontInitValues(&terminalFont->font, font.chars, &font.chars[equal + strlen("size=")]); } +static void detectQTerminal(const FFinstance* instance, FFTerminalFontResult* terminalFont) +{ + FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate(); + FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate(); + + ffParsePropFileConfigValues(instance, "qterminal.org/qterminal.ini", 2, (FFpropquery[]) { + {"fontFamily=", &fontName}, + {"fontSize=", &fontSize}, + }); + + if (fontName.length == 0) + ffStrbufAppendS(&fontName, "monospace"); + if (fontSize.length == 0) + ffStrbufAppendS(&fontSize, "12"); + ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars); +} + void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalShellResult* terminalShell, FFTerminalFontResult* terminalFont) { if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "konsole") == 0) @@ -237,4 +254,6 @@ void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalSh detectDeepinTerminal(instance, terminalFont); else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "foot") == 0) detectFootTerminal(instance, terminalFont); + else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "qterminal") == 0) + detectQTerminal(instance, terminalFont); } From 618e5f01df9481481fb3f05ee947c92b525ded17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 12:37:42 +0800 Subject: [PATCH 07/47] Wallpaper (Linux): support lxqt --- CHANGELOG.md | 2 +- src/detection/gtk_qt/qt.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0ea958d7..9b31ca5b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # 1.11.4 Features: -* Support KDE wallpaper detection (Wallpaper, Linux) +* Support KDE / LXQT wallpaper detection (Wallpaper, Linux) * Support QTerminal version & terminal font detection # 1.11.3 diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index 53384f8d1..0cd575adb 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -135,6 +135,8 @@ static void detectLXQt(const FFinstance* instance, FFQtResult* result) {"icon_theme = ", &result->icons}, {"font = ", &result->font} }); + + ffParsePropFileConfig(instance, "pcmanfm-qt/lxqt/settings.conf", "Wallpaper=", &result->wallpaper); } const FFQtResult* ffDetectQt(const FFinstance* instance) From 9000432b524cc16a9233b2e310de5fa7a8f82484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 12:59:43 +0800 Subject: [PATCH 08/47] Wallpaper (Linux): fix xfce wallpaper detection on my laptop --- src/detection/gtk_qt/gtk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/detection/gtk_qt/gtk.c b/src/detection/gtk_qt/gtk.c index e61c951aa..0e2c424b0 100644 --- a/src/detection/gtk_qt/gtk.c +++ b/src/detection/gtk_qt/gtk.c @@ -68,6 +68,8 @@ 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; wallpaper = ffSettingsGetXFConf(instance, "xfce4-desktop", "/backdrop/screen0/monitor0/workspace0/last-image", FF_VARIANT_TYPE_STRING).strValue; + if (!wallpaper) // FIXME: find a way to enumerate possible properties + wallpaper = ffSettingsGetXFConf(instance, "xfce4-desktop", "/backdrop/screen0/monitoreDP-1/workspace0/last-image", FF_VARIANT_TYPE_STRING).strValue; } else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_CINNAMON) == 0) { From ae2855d12330724edc35d7c85adfafb5692de964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 13:28:02 +0800 Subject: [PATCH 09/47] Terminal (Linux): support MATE terminal version detection --- src/detection/terminalshell/terminalshell.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 00aa1bc6e..b7497b775 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -203,6 +203,15 @@ FF_MAYBE_UNUSED static bool getTerminalVersionFoot(FFstrbuf* exe, FFstrbuf* vers return true; } +FF_MAYBE_UNUSED static bool getTerminalVersionMateTerminal(FFstrbuf* exe, FFstrbuf* version) +{ + if(!getExeVersionRaw(exe, version)) return false; + + //MATE Terminal 1.26.1 + ffStrbufSubstrAfterLastC(version, ' '); + return version->length > 0; +} + #ifdef _WIN32 static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version) @@ -261,6 +270,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufIgnCaseEqualS(processName, "qterminal")) return getExeVersionRaw(exe, version); //1.2.0 + if(ffStrbufIgnCaseEqualS(processName, "mate-terminal")) + return getTerminalVersionMateTerminal(exe, version); + #endif #ifdef _WIN32 From 51ba806e6d62ef33dc2154078de16eb52f0900c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 14:06:23 +0800 Subject: [PATCH 10/47] TerminalFont (Linux): support MATE Terminal --- CHANGELOG.md | 1 + README.md | 2 +- .../terminalfont/terminalfont_linux.c | 30 ++++++++++--------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b31ca5b9..0109df52f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Features: * Support KDE / LXQT wallpaper detection (Wallpaper, Linux) * Support QTerminal version & terminal font detection +* Support MATE Terminal version & terminal font detection # 1.11.3 diff --git a/README.md b/README.md index 996b328ba..1b5945393 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Budgie, Cinnamon, Gnome, KDE Plasma, LXQt, Mate, XFCE4 ##### Terminal fonts ``` -Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, mintty, QTerminal, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal +Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, MATE Terminal, mintty, QTerminal, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal ``` ## Building diff --git a/src/detection/terminalfont/terminalfont_linux.c b/src/detection/terminalfont/terminalfont_linux.c index 28565fefa..c652cbde6 100644 --- a/src/detection/terminalfont/terminalfont_linux.c +++ b/src/detection/terminalfont/terminalfont_linux.c @@ -10,13 +10,13 @@ static const char* getSystemMonospaceFont(const FFinstance* instance) { const FFDisplayServerResult* wmde = ffConnectDisplayServer(instance); - if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Cinnamon") == 0) + if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, "Cinnamon")) { const char* systemMonospaceFont = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/monospace-font-name", "org.cinnamon.desktop.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue; if(ffStrSet(systemMonospaceFont)) return systemMonospaceFont; } - else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, "Mate") == 0) + else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, "Mate")) { const char* systemMonospaceFont = ffSettingsGet(instance, "/org/mate/interface/monospace-font-name", "org.mate.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue; if(ffStrSet(systemMonospaceFont)) @@ -26,9 +26,9 @@ static const char* getSystemMonospaceFont(const FFinstance* instance) return ffSettingsGet(instance, "/org/gnome/desktop/interface/monospace-font-name", "org.gnome.desktop.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue; } -static void detectFromGSettings(const FFinstance* instance, char* profilePath, char* profileList, char* profile, FFTerminalFontResult* terminalFont) +static void detectFromGSettings(const FFinstance* instance, const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont) { - const char* defaultProfile = ffSettingsGetGSettings(instance, profileList, NULL, "default", FF_VARIANT_TYPE_STRING).strValue; + const char* defaultProfile = ffSettingsGetGSettings(instance, profileList, NULL, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue; if(!ffStrSet(defaultProfile)) { ffStrbufAppendF(&terminalFont->error, "Could not get default profile from gsettings: %s", profileList); @@ -240,20 +240,22 @@ static void detectQTerminal(const FFinstance* instance, FFTerminalFontResult* te void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalShellResult* terminalShell, FFTerminalFontResult* terminalFont) { - if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "konsole") == 0) + if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "konsole")) detectKonsole(instance, terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "xfce4-terminal") == 0) + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "xfce4-terminal")) detectXFCETerminal(instance, terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "lxterminal") == 0) + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "lxterminal")) detectFromConfigFile(instance, "lxterminal/lxterminal.conf", "fontname =", terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "tilix") == 0) - detectFromGSettings(instance, "/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "gnome-terminal-") == 0) - detectFromGSettings(instance, "/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "deepin-terminal") == 0) + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "tilix")) + detectFromGSettings(instance, "/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont); + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "gnome-terminal-")) + detectFromGSettings(instance, "/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont); + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "mate-terminal")) + detectFromGSettings(instance, "/org/mate/terminal/profiles/", "org.mate.terminal.global", "org.mate.terminal.profile", "default-profile", terminalFont); + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "deepin-terminal")) detectDeepinTerminal(instance, terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "foot") == 0) + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "foot")) detectFootTerminal(instance, terminalFont); - else if(ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "qterminal") == 0) + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "qterminal")) detectQTerminal(instance, terminalFont); } From 55b8c0947bf0c4fabe814cf9ecdeae9804a8535c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 14:14:23 +0800 Subject: [PATCH 11/47] Wallpaper (Linux): support MATE --- CHANGELOG.md | 2 +- src/detection/gtk_qt/gtk.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0109df52f..4b0a0ee27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # 1.11.4 Features: -* Support KDE / LXQT wallpaper detection (Wallpaper, Linux) +* Support KDE / LXQT / MATE wallpaper detection (Wallpaper, Linux) * Support QTerminal version & terminal font detection * Support MATE Terminal version & terminal font detection diff --git a/src/detection/gtk_qt/gtk.c b/src/detection/gtk_qt/gtk.c index 0e2c424b0..c42ffc1b7 100644 --- a/src/detection/gtk_qt/gtk.c +++ b/src/detection/gtk_qt/gtk.c @@ -86,6 +86,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul fontName = ffSettingsGet(instance, "/org/mate/interface/font-name", "org.mate.interface", NULL, "font-name", FF_VARIANT_TYPE_STRING).strValue; cursorTheme = ffSettingsGet(instance, "/org/mate/peripherals-mouse/cursor-theme", "org.mate.peripherals-mouse", NULL, "cursor-theme", FF_VARIANT_TYPE_STRING).strValue; cursorSize = ffSettingsGet(instance, "/org/mate/peripherals-mouse/cursor-size", "org.mate.peripherals-mouse", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue; + wallpaper = ffSettingsGet(instance, "/org/mate/desktop/background", "org.mate.background", NULL, "picture-filename", FF_VARIANT_TYPE_STRING).strValue; } else if( ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_GNOME) == 0 || From 1de049bdf59ca050a766f1a1ca3bf0dcbdc366c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 11 Jun 2023 14:26:57 +0800 Subject: [PATCH 12/47] Wallpaper (Linux): support Cinnamon --- CHANGELOG.md | 2 +- src/detection/gtk_qt/gtk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b0a0ee27..6a0b81453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # 1.11.4 Features: -* Support KDE / LXQT / MATE wallpaper detection (Wallpaper, Linux) +* Support KDE / LXQT / MATE / Cinnamon wallpaper detection (Wallpaper, Linux) * Support QTerminal version & terminal font detection * Support MATE Terminal version & terminal font detection diff --git a/src/detection/gtk_qt/gtk.c b/src/detection/gtk_qt/gtk.c index c42ffc1b7..ca5778033 100644 --- a/src/detection/gtk_qt/gtk.c +++ b/src/detection/gtk_qt/gtk.c @@ -78,6 +78,7 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul fontName = ffSettingsGet(instance, "/org/cinnamon/desktop/interface/font-name", "org.cinnamon.desktop.interface", NULL, "font-name", FF_VARIANT_TYPE_STRING).strValue; 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; + wallpaper = ffSettingsGet(instance, "/org/cinnamon/desktop/background/picture-uri", "org.cinnamon.desktop.background", NULL, "picture-uri", FF_VARIANT_TYPE_STRING).strValue; } else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_MATE) == 0) { @@ -99,7 +100,6 @@ static void detectGTKFromSettings(const FFinstance* instance, FFGTKResult* resul cursorTheme = ffSettingsGet(instance, "/org/gnome/desktop/interface/cursor-theme", "org.gnome.desktop.interface", NULL, "cursor-theme", FF_VARIANT_TYPE_STRING).strValue; cursorSize = ffSettingsGet(instance, "/org/gnome/desktop/interface/cursor-size", "org.gnome.desktop.interface", NULL, "cursor-size", FF_VARIANT_TYPE_INT).intValue; wallpaper = ffSettingsGet(instance, "/org/gnome/desktop/background/picture-uri", "org.gnome.desktop.background", NULL, "picture-uri", FF_VARIANT_TYPE_STRING).strValue; - // TODO: support other DEs for wallpaper } ffThreadMutexUnlock(&mutex); From 7aecf385e25b2bdbb5f002dc92f20d38aa5703ba Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 12 Jun 2023 15:10:41 +0200 Subject: [PATCH 13/47] Include limits.h when needed Fixes #472 --- src/detection/brightness/brightness_linux.c | 1 + src/detection/gtk_qt/qt.c | 1 + src/logo/image/image.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/detection/brightness/brightness_linux.c b/src/detection/brightness/brightness_linux.c index 3222faeae..a8fd4ed4b 100644 --- a/src/detection/brightness/brightness_linux.c +++ b/src/detection/brightness/brightness_linux.c @@ -3,6 +3,7 @@ #include #include +#include const char* ffDetectBrightness(FF_MAYBE_UNUSED FFlist* result) { diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index 0cd575adb..76ee6404b 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -101,6 +101,7 @@ static void detectPlasma(const FFinstance* instance, FFQtResult* result) ffStrbufAppendS(&baseDir, "plasma-org.kde.plasma.desktop-appletsrc"); ffParsePropFile(baseDir.chars, "Image=", &result->wallpaper); + puts(result->wallpaper.chars); if(allValuesSet(result)) { diff --git a/src/logo/image/image.c b/src/logo/image/image.c index 9c9e0d390..4fe3b2a57 100644 --- a/src/logo/image/image.c +++ b/src/logo/image/image.c @@ -2,6 +2,8 @@ #include "common/io/io.h" #include "common/printing.h" +#include + #ifdef __APPLE__ #include #elif _WIN32 From e5de3a90c61c1181bb7410bf2723cc9111c2077c Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 12 Jun 2023 15:12:25 +0200 Subject: [PATCH 14/47] Remove debug statement --- src/detection/gtk_qt/qt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index 76ee6404b..0cd575adb 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -101,7 +101,6 @@ static void detectPlasma(const FFinstance* instance, FFQtResult* result) ffStrbufAppendS(&baseDir, "plasma-org.kde.plasma.desktop-appletsrc"); ffParsePropFile(baseDir.chars, "Image=", &result->wallpaper); - puts(result->wallpaper.chars); if(allValuesSet(result)) { From c451a377c9a01bf3c41394e273e8097d94f8bee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 12 Jun 2023 21:18:22 +0800 Subject: [PATCH 15/47] CMake: make some serious warnings as errors --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94f68f62e..e1c4a615c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,12 +96,14 @@ else() message(STATUS "Threads type: disabled") endif() +set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=uninitialized -Werror=return-type") + set(CMAKE_C_STANDARD 11) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") if(WIN32) set(CMAKE_CXX_STANDARD 11) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wconversion -fno-exceptions -fno-rtti") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -fno-exceptions -fno-rtti") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--tsaware -Wl,--build-id -Wl,--subsystem,console:6.1,--major-os-version,6,--minor-os-version,1") endif() From 07eddf9772526e2a94af0b40fd686ced4ae1e3dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 13 Jun 2023 11:12:31 +0800 Subject: [PATCH 16/47] GPU (Linux): always initialize variables --- src/detection/gpu/gpu_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index 63697050f..6845a939d 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -46,7 +46,7 @@ static void pciDetectVendorName(FFGPUResult* gpu, PCIData* pci, struct pci_dev* static void drmDetectDeviceName(const FFinstance* instance, FFGPUResult* gpu, PCIData* pci, struct pci_dev* device) { - u8 revId; + u8 revId = 0; bool revIdSet = false; #if PCI_LIB_VERSION >= 0x030800 From 6e7a6174ba2bc9234d6edb8f40350d1c3f2d4bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 14 Jun 2023 22:41:40 +0800 Subject: [PATCH 17/47] Disk (Linux): don't detect WSL drives as subvolumes --- src/detection/disk/disk_linux.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/detection/disk/disk_linux.c b/src/detection/disk/disk_linux.c index 6f4eab2bc..d9420d236 100644 --- a/src/detection/disk/disk_linux.c +++ b/src/detection/disk/disk_linux.c @@ -147,20 +147,23 @@ static void detectType(FF_MAYBE_UNUSED const FFlist* devices, FFDisk* currentDis static bool isSubvolume(const FFlist* devices) { - const FFstrbuf* currentDevie = ffListGet(devices, devices->length - 1); + const FFstrbuf* current = ffListGet(devices, devices->length - 1); + + if(ffStrbufEqualS(current, "drvfs")) // WSL Windows drives + return false; //Filter all disks which device was already found. This catches BTRFS subvolumes. for(uint32_t i = 0; i < devices->length - 1; i++) { const FFstrbuf* otherDevice = ffListGet(devices, i); - if(ffStrbufEqual(currentDevie, otherDevice)) + if(ffStrbufEqual(current, otherDevice)) return true; } //ZFS subvolumes: rpool///. //Test if the third slash is present. - if(strncmp(currentDevie->chars, "rpool/", 6) == 0 && ffStrHasNChars(currentDevie->chars, '/', 3)) + if(ffStrbufStartsWithS(current, "rpool/") && ffStrHasNChars(current->chars, '/', 3)) return true; return false; From 0b00b5ffe0dc2fbd268462bc774a00e0cbb76e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 15 Jun 2023 09:35:47 +0800 Subject: [PATCH 18/47] FreeBSD (CPU): fix temperature detection --- src/detection/cpu/cpu_bsd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/detection/cpu/cpu_bsd.c b/src/detection/cpu/cpu_bsd.c index 2308c8985..0ae8010b1 100644 --- a/src/detection/cpu/cpu_bsd.c +++ b/src/detection/cpu/cpu_bsd.c @@ -7,9 +7,8 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu) if (instance->config.cpuTemp) { - FFstrbuf cpuTemp; - ffStrbufInit(&cpuTemp); - if(ffSysctlGetString("temperature", &cpuTemp)) + FF_STRBUF_AUTO_DESTROY cpuTemp = ffStrbufCreate(); + if(ffSysctlGetString("hw.acpi.thermal.tz0.temperature", &cpuTemp)) cpu->temperature = FF_CPU_TEMP_UNSET; else cpu->temperature = ffStrbufToDouble(&cpuTemp); From a059c55f056ac288b3dc98b5eebd3b09a1beb423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 15 Jun 2023 11:19:53 +0800 Subject: [PATCH 19/47] Memory (FreeBSD): count cached memory as free memory As what neofetch did --- src/detection/memory/memory_bsd.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/detection/memory/memory_bsd.c b/src/detection/memory/memory_bsd.c index 05c74172f..e856b1256 100644 --- a/src/detection/memory/memory_bsd.c +++ b/src/detection/memory/memory_bsd.c @@ -3,19 +3,21 @@ const char* ffDetectMemory(FFMemoryResult* ram) { + uint64_t length = sizeof(ram->bytesTotal); + if (sysctl((int[]){ CTL_HW, HW_PHYSMEM }, 2, &ram->bytesTotal, &length, NULL, 0)) + return "Failed to read hw.physmem"; + uint32_t pageSize; - uint64_t length = sizeof(pageSize); + length = sizeof(pageSize); if (sysctl((int[]){ CTL_HW, HW_PAGESIZE }, 2, &pageSize, &length, NULL, 0)) return "Failed to read hw.pagesize"; - ram->bytesTotal = (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_page_count", 0) * pageSize; - if(ram->bytesTotal == 0) - return "Failed to read vm.stats.vm.v_page_count"; + // vm.stats.vm.* are int values + int32_t pagesFree = ffSysctlGetInt("vm.stats.vm.v_free_count", 0) + + ffSysctlGetInt("vm.stats.vm.v_inactive_count", 0) + + ffSysctlGetInt("vm.stats.vm.v_cache_count", 0); - ram->bytesUsed = ram->bytesTotal - - (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_free_count", 0) * pageSize - - (uint64_t) ffSysctlGetInt64("vm.stats.vm.v_inactive_count", 0) * pageSize - ; + ram->bytesUsed = ram->bytesTotal - (uint64_t) pagesFree * pageSize; return NULL; } From 033cced5a93484857327302e52da86325172fd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 16 Jun 2023 20:40:50 +0800 Subject: [PATCH 20/47] CMake (Windows): silence compiler warnings --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e1c4a615c..f15b290a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,10 +96,10 @@ else() message(STATUS "Threads type: disabled") endif() -set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=uninitialized -Werror=return-type") +set(WARNING_FLAGS "-Wall -Wextra -Wconversion -Werror=uninitialized -Werror=return-type") set(CMAKE_C_STANDARD 11) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} -Werror=incompatible-pointer-types -Werror=implicit-function-declaration") if(WIN32) set(CMAKE_CXX_STANDARD 11) From ec049fd49047bbb3ac1f675010f3aca484ed0774 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 18 Jun 2023 12:49:53 +0800 Subject: [PATCH 21/47] Fastfetch: set `pipe=true` automatically if stdout is not a tty --- src/common/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/init.c b/src/common/init.c index 372b2dd8f..4b7f1ce4f 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -60,12 +60,12 @@ static void defaultConfig(FFinstance* instance) instance->config.showErrors = false; instance->config.recache = false; instance->config.allowSlowOperations = false; - instance->config.disableLinewrap = true; - instance->config.hideCursor = true; + instance->config.pipe = !isatty(STDOUT_FILENO); + instance->config.disableLinewrap = !instance->config.pipe; + instance->config.hideCursor = !instance->config.pipe; instance->config.escapeBedrock = true; instance->config.binaryPrefixType = FF_BINARY_PREFIX_TYPE_IEC; instance->config.glType = FF_GL_TYPE_AUTO; - instance->config.pipe = false; instance->config.multithreading = true; instance->config.stat = false; From 8088905721f0392f8f3b71b4d0ef829e800180c6 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 18 Jun 2023 14:16:06 +0800 Subject: [PATCH 22/47] Host (macOS): update newest product name data --- src/detection/host/host_apple.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/detection/host/host_apple.c b/src/detection/host/host_apple.c index 4f739276b..b696f9a7d 100644 --- a/src/detection/host/host_apple.c +++ b/src/detection/host/host_apple.c @@ -112,6 +112,10 @@ static const char* getProductName(const FFstrbuf* hwModel) else if(ffStrbufStartsWithS(hwModel, "Mac")) { const char* version = hwModel->chars + strlen("Mac"); + if(strEqual(version, "14,15")) return "MacBook Air (15-inch, M2, 2023)"; + if(strEqual(version, "14,14")) return "Mac Studio (M2 Max, 2023, Two USB-C front ports)"; + if(strEqual(version, "14,13")) return "Mac Studio (M2 Ultra, 2023, Two Thunderbolt 4 front ports)"; + if(strEqual(version, "14,8")) return "Mac Pro (2023)"; if(strEqual(version, "14,6") || strEqual(version, "14,10")) return "MacBook Pro (16-inch, 2023)"; if(strEqual(version, "14,5") || From 2ec03534239ced8ea1e5643d50623cc7e7129fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 19 Jun 2023 19:59:21 +0800 Subject: [PATCH 23/47] Disk (Android): actually detect something --- src/detection/disk/disk_linux.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/detection/disk/disk_linux.c b/src/detection/disk/disk_linux.c index d9420d236..a3c7ca52a 100644 --- a/src/detection/disk/disk_linux.c +++ b/src/detection/disk/disk_linux.c @@ -17,6 +17,8 @@ static bool isPhysicalDevice(FFstrbuf* device) { + #ifndef __ANDROID__ //On Android, `/dev` is not accessable, so that the following checks always fail + //DrvFs is a filesystem plugin to WSL that was designed to support interop between WSL and the Windows filesystem. if(ffStrbufEqualS(device, "drvfs")) return true; @@ -37,6 +39,8 @@ static bool isPhysicalDevice(FFstrbuf* device) if(!ffStrbufStartsWithS(device, "/dev/")) return false; + #endif // __ANDROID__ + if( ffStrbufStartsWithS(device, "/dev/loop") || //Ignore loop devices ffStrbufStartsWithS(device, "/dev/ram") || //Ignore ram devices From 19942195313b8e2bdc7b69739c431bf6904ea3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 20 Jun 2023 18:15:30 +0800 Subject: [PATCH 24/47] DisplayServer (Linux): mark `plasmashell --version` as slow operation It costs more than 1 sec some time --- src/detection/displayserver/linux/wmde.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/displayserver/linux/wmde.c b/src/detection/displayserver/linux/wmde.c index a7ac96b8d..3b9b50ebf 100644 --- a/src/detection/displayserver/linux/wmde.c +++ b/src/detection/displayserver/linux/wmde.c @@ -132,7 +132,7 @@ static void getKDE(const FFinstance* instance, FFDisplayServerResult* result) ffParsePropFileData(instance, "wayland-sessions/plasmawayland.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); if(result->deVersion.length == 0) ffParsePropFileData(instance, "wayland-sessions/plasmawayland5.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); - if(result->deVersion.length == 0) + if(result->deVersion.length == 0 && instance->config.allowSlowOperations) { if (ffProcessAppendStdOut(&result->deVersion, (char* const[]){ "plasmashell", From 161f86eb45471a328c5f0538324ba8f9f7bc39bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 20 Jun 2023 18:31:44 +0800 Subject: [PATCH 25/47] DisplayServer (Linux): add fast path of kde version detection for Fedora --- src/detection/displayserver/linux/wmde.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/detection/displayserver/linux/wmde.c b/src/detection/displayserver/linux/wmde.c index 3b9b50ebf..12c9185bf 100644 --- a/src/detection/displayserver/linux/wmde.c +++ b/src/detection/displayserver/linux/wmde.c @@ -125,13 +125,24 @@ static void getKDE(const FFinstance* instance, FFDisplayServerResult* result) ffStrbufSetS(&result->deProcessName, "plasmashell"); ffStrbufSetS(&result->dePrettyName, FF_DE_PRETTY_PLASMA); - ffParsePropFileData(instance, "xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); + ffParsePropFileValues("/usr/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) { + {"X-KDE-PluginInfo-Version =", &result->deVersion} + }); + if(result->deVersion.length == 0) + ffParsePropFileData(instance, "xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); if(result->deVersion.length == 0) ffParsePropFileData(instance, "xsessions/plasma5.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); + if(result->deVersion.length == 0) + { + ffParsePropFileValues("/usr/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) { + {"X-KDE-PluginInfo-Version =", &result->deVersion} + }); + } if(result->deVersion.length == 0) ffParsePropFileData(instance, "wayland-sessions/plasmawayland.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); if(result->deVersion.length == 0) ffParsePropFileData(instance, "wayland-sessions/plasmawayland5.desktop", "X-KDE-PluginInfo-Version =", &result->deVersion); + if(result->deVersion.length == 0 && instance->config.allowSlowOperations) { if (ffProcessAppendStdOut(&result->deVersion, (char* const[]){ From 67689f92297eb6934bc3cb1f9f5d2d6078800e88 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 22 Jun 2023 01:38:25 +0000 Subject: [PATCH 26/47] Terminal (FreeBSD): fix Gnome Terminal version detetion on FreeBSD --- src/detection/terminalshell/terminalshell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index b7497b775..d6a93d17a 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -252,7 +252,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe #if defined(__linux__) || defined(__FreeBSD__) - if(ffStrbufIgnCaseEqualS(processName, "gnome-terminal-")) + if(ffStrbufStartsWithIgnCaseS(processName, "gnome-terminal-")) return getTerminalVersionGnome(version); if(ffStrbufIgnCaseEqualS(processName, "konsole")) From a63925483c1527add2cfe9514de48e3d786bb062 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 22 Jun 2023 02:01:33 +0000 Subject: [PATCH 27/47] Terminal (Linux): print `gnome-terminal-server` as `gnome-terminal` --- src/detection/terminalshell/terminalshell_linux.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 6fb5cc008..e13cd7725 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -378,12 +378,22 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance) ffStrbufInitS(&result.shellPrettyName, result.shellExeName); } - if(ffStrbufEqualS(&result.terminalProcessName, "iTerm.app") || ffStrbufStartsWithS(&result.terminalProcessName, "iTermServer-")) + #if defined(__linux__) || defined(__FreeBSD__) + + if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-")) + ffStrbufInitS(&result.terminalPrettyName, "gnome-terminal"); + + #elif defined(__APPLE__) + + else if(ffStrbufEqualS(&result.terminalProcessName, "iTerm.app") || ffStrbufStartsWithS(&result.terminalProcessName, "iTermServer-")) ffStrbufInitS(&result.terminalPrettyName, "iTerm"); else if(ffStrbufEqualS(&result.terminalProcessName, "Apple_Terminal")) ffStrbufInitS(&result.terminalPrettyName, "Apple Terminal"); else if(ffStrbufEqualS(&result.terminalProcessName, "WarpTerminal")) ffStrbufInitS(&result.terminalPrettyName, "Warp"); + + #endif + else if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui")) ffStrbufInitS(&result.terminalPrettyName, "WezTerm"); else if(strncmp(result.terminalExeName, result.terminalProcessName.chars, result.terminalProcessName.length) == 0) // if exeName starts with processName, print it. Otherwise print processName From 9568eb8dd3b59dd5dcc4139353917d0a4a094688 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 22 Jun 2023 02:12:59 +0000 Subject: [PATCH 28/47] TerminalFont (FreeBSD): fix gnome-terminal font detection --- src/detection/terminalfont/terminalfont_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/terminalfont/terminalfont_linux.c b/src/detection/terminalfont/terminalfont_linux.c index c652cbde6..6b08c41c5 100644 --- a/src/detection/terminalfont/terminalfont_linux.c +++ b/src/detection/terminalfont/terminalfont_linux.c @@ -248,7 +248,7 @@ void ffDetectTerminalFontPlatform(const FFinstance* instance, const FFTerminalSh detectFromConfigFile(instance, "lxterminal/lxterminal.conf", "fontname =", terminalFont); else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "tilix")) detectFromGSettings(instance, "/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont); - else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "gnome-terminal-")) + else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalProcessName, "gnome-terminal-")) detectFromGSettings(instance, "/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont); else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "mate-terminal")) detectFromGSettings(instance, "/org/mate/terminal/profiles/", "org.mate.terminal.global", "org.mate.terminal.profile", "default-profile", terminalFont); From e63669bea33fc802d8e67ac8833d7d7cc6fcbcff Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 22 Jun 2023 03:07:18 +0000 Subject: [PATCH 29/47] Logo: more BSD logos --- src/logo/builtin.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 656babf3e..ab670e6a8 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -328,6 +328,43 @@ static const FFlogo* getLogoArcoLinux() FF_LOGO_RETURN } +static const FFlogo* getLogoBSD() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("bsd") + FF_LOGO_LINES( +"$1 , ,\n" +" /( )`\n" +" \\ \\___ / |\n" +" /- _ `-/ '\n" +" ($2/\\/ \\ $1\\ /\\\n" +" $2/ / | ` $1\\\n" +" $3O O $2) $1/ |\n" +" $2`-^--'$1`< '\n" +" (_.) _ ) /\n" +" `.___/` /\n" +" `-----' /\n" +"$4<----. __ / __ \\\n" +"$4<----|====$1O)))$4==$1) \\) /$4====|\n" +"<----' $1`--' `.__,' \\\n" +" | |\n" +" \\ / /\\\n" +" $5______$1( (_ / \\______/\n" +" $5,' ,-----' |\n" +" `--{__________)\n" + ) + FF_LOGO_COLORS( + "31", + "37", + "34", + "33", + "36" + ) + FF_LOGO_COLOR_KEYS("31"); + FF_LOGO_COLOR_TITLE("37"); + FF_LOGO_RETURN +} + static const FFlogo* getLogoBedrock() { FF_LOGO_INIT @@ -899,6 +936,26 @@ static const FFlogo* getLogoFreeBSD() FF_LOGO_RETURN } +static const FFlogo* getLogoFreeBSDSmall() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("freebsd_small") + FF_LOGO_LINES( + "$1/\\,-'''''-,/\\\n" + "\\_) (_/\n" + "| |\n" + "| |\n" + " ; ;\n" + " '-_____-'" + ) + FF_LOGO_COLORS( + "31" //red + ) + FF_LOGO_COLOR_KEYS("31") //red + FF_LOGO_COLOR_TITLE("31") //red + FF_LOGO_RETURN +} + static const FFlogo* getLogoGaruda() { FF_LOGO_INIT @@ -1005,6 +1062,35 @@ static const FFlogo* getLogoGentooSmall() FF_LOGO_RETURN } +#define FF_RAW_STRING(x) #x + +static const FFlogo* getLogoGhostBSD() +{ + FF_LOGO_INIT + FF_LOGO_NAMES("ghostbsd") + FF_LOGO_LINES( + "$1 ,gggggg.\n" + " ,agg9* .g)\n" + " .agg* ._.,gg*\n" + " ,gga* (ggg*'\n" + " ,ga* ,ga*\n" + " ,ga' .ag*\n" + " ,ga' .agga'\n" + " 9g' .agg'g*,a\n" + " 'gggg*',gga'\n" + " .gg*'\n" + " .gga*\n" + " .gga*\n" + " (ga*" + ) + FF_LOGO_COLORS( + "34" //blue + ) + FF_LOGO_COLOR_KEYS("34"); //blue + FF_LOGO_COLOR_TITLE("31"); //red + FF_LOGO_RETURN +} + static const FFlogo* getLogoKDENeon() { FF_LOGO_INIT @@ -2525,6 +2611,7 @@ GetLogoMethod* ffLogoBuiltinGetAll() getLogoArtix, getLogoArtixSmall, getLogoBedrock, + getLogoBSD, getLogoCachyOS, getLogoCachyOSSmall, getLogoCelOS, @@ -2543,10 +2630,12 @@ GetLogoMethod* ffLogoBuiltinGetAll() getLogoFedoraSmall, getLogoFedoraOld, getLogoFreeBSD, + getLogoFreeBSDSmall, getLogoGaruda, getLogoGarudaSmall, getLogoGentoo, getLogoGentooSmall, + getLogoGhostBSD, getLogoKDENeon, getLogoKISSLinux, getLogoKubuntu, From 2d80085d6e02a05c87acfbe04f0841d941f90bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 22 Jun 2023 14:53:15 +0800 Subject: [PATCH 30/47] Logo (Windows): make Windows logos colorable --- src/logo/builtin.c | 72 ++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/src/logo/builtin.c b/src/logo/builtin.c index ab670e6a8..4962331e3 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -1505,26 +1505,28 @@ static const FFlogo* getLogoWindows11() FF_LOGO_INIT FF_LOGO_NAMES("Windows 11", "Windows Server 2022") FF_LOGO_LINES( - "$1\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" + "$1///////////////// $2/////////////////\n" "\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////\n" - "///////////////// /////////////////" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////\n" + "$3///////////////// $4/////////////////" ) FF_LOGO_COLORS( + "34", //blue + "34", //blue + "34", //blue "34" //blue ) FF_LOGO_COLOR_KEYS("33"); //yellow @@ -1537,8 +1539,7 @@ static const FFlogo* getLogoWindows11Small() FF_LOGO_INIT FF_LOGO_NAMES("Windows 11_small", "Windows 11-small") FF_LOGO_LINES( - "$1\n" - "lllllllll lllllllll\n" + "$1lllllllll lllllllll\n" "lllllllll lllllllll\n" "lllllllll lllllllll\n" "lllllllll lllllllll\n" @@ -1561,27 +1562,30 @@ static const FFlogo* getLogoWindows8() FF_LOGO_INIT FF_LOGO_NAMES("Windows 8", "Windows 8.1", "Windows 10", "Windows Server 2012", "Windows Server 2012 R2", "Windows Server 2016", "Windows Server 2019") FF_LOGO_LINES( - "$1 ..,\n" + " $2..,\n" " ....,,:;+ccllll\n" - " ...,,+:; cllllllllllllllllll\n" - ",cclllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" + "$1 ...,,+:; $2cllllllllllllllllll\n" + "$1,cclllllllllll $2lllllllllllllllllll\n" + "$1llllllllllllll $2lllllllllllllllllll\n" + "$1llllllllllllll $2lllllllllllllllllll\n" + "$1llllllllllllll $2lllllllllllllllllll\n" + "$1llllllllllllll $2lllllllllllllllllll\n" + "$1llllllllllllll $2lllllllllllllllllll\n" "\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "llllllllllllll lllllllllllllllllll\n" - "`'ccllllllllll lllllllllllllllllll\n" - " `' \\*:: :ccllllllllllllllll\n" + "$3llllllllllllll $4lllllllllllllllllll\n" + "$3llllllllllllll $4lllllllllllllllllll\n" + "$3llllllllllllll $4lllllllllllllllllll\n" + "$3llllllllllllll $4lllllllllllllllllll\n" + "$3llllllllllllll $4lllllllllllllllllll\n" + "$3`'ccllllllllll $4lllllllllllllllllll\n" + "$3 `' \\*:: $4:ccllllllllllllllll\n" " ````''*::cll\n" " ``" ) FF_LOGO_COLORS( + "36", //cyan + "36", //cyan + "36", //cyan "36" //cyan ) FF_LOGO_COLOR_KEYS("33"); //yellow From c7becf82bd2eea796d226025716859749d992e7d Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 23 Jun 2023 05:34:23 +0000 Subject: [PATCH 31/47] DisplayServer (Wayland): warn if some properties of wl_output_listener are not supported --- src/detection/displayserver/linux/wayland.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/detection/displayserver/linux/wayland.c b/src/detection/displayserver/linux/wayland.c index 7e7f98fb5..78b590995 100644 --- a/src/detection/displayserver/linux/wayland.c +++ b/src/detection/displayserver/linux/wayland.c @@ -141,18 +141,26 @@ static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* regist #ifdef WL_OUTPUT_DONE_SINCE_VERSION .done = (void*) stubListener, + #else + #warning wl_output_listener::done is not supported #endif #ifdef WL_OUTPUT_SCALE_SINCE_VERSION .scale = waylandOutputScaleListener, + #else + #warning wl_output_listener::scale is not supported #endif #ifdef WL_OUTPUT_NAME_SINCE_VERSION .name = waylandOutputNameListener, + #else + #warning wl_output_listener::name is not supported #endif #ifdef WL_OUTPUT_DESCRIPTION_SINCE_VERSION .description = (void*) stubListener, + #else + #warning wl_output_listener::description is not supported #endif }; From 96a8548c591408d71603cd1e926eb150fbccc3c3 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 23 Jun 2023 06:07:22 +0000 Subject: [PATCH 32/47] DisplayServer: dirty hack for #477 --- src/detection/displayserver/linux/wayland.c | 45 +++++++-------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/src/detection/displayserver/linux/wayland.c b/src/detection/displayserver/linux/wayland.c index 78b590995..fbf0a211e 100644 --- a/src/detection/displayserver/linux/wayland.c +++ b/src/detection/displayserver/linux/wayland.c @@ -9,6 +9,7 @@ #include "common/thread.h" #include #include +#include typedef struct WaylandData { @@ -73,13 +74,11 @@ static void waylandOutputModeListener(void* data, FF_MAYBE_UNUSED struct wl_outp display->refreshRate = refreshRate; } -#ifdef WL_OUTPUT_SCALE_SINCE_VERSION static void waylandOutputScaleListener(void* data, FF_MAYBE_UNUSED struct wl_output* output, int32_t scale) { WaylandDisplay* display = data; display->scale = scale; } -#endif static void waylandOutputGeometryListener(void *data, FF_MAYBE_UNUSED struct wl_output *output, @@ -107,7 +106,6 @@ static void waylandOutputGeometryListener(void *data, } } -#ifdef WL_OUTPUT_NAME_SINCE_VERSION static void waylandOutputNameListener(void *data, FF_MAYBE_UNUSED struct wl_output *output, const char *name) { WaylandDisplay* display = data; @@ -116,7 +114,6 @@ static void waylandOutputNameListener(void *data, FF_MAYBE_UNUSED struct wl_outp else if(strncmp(name, "HDMI-", strlen("HDMI-")) == 0 || strncmp(name, "DP-", strlen("DP-")) == 0) display->type = FF_DISPLAY_TYPE_EXTERNAL; } -#endif static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) { @@ -135,34 +132,20 @@ static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* regist }; ffStrbufInit(&display.name); - struct wl_output_listener outputListener = { - .mode = waylandOutputModeListener, - .geometry = waylandOutputGeometryListener, - - #ifdef WL_OUTPUT_DONE_SINCE_VERSION - .done = (void*) stubListener, - #else - #warning wl_output_listener::done is not supported - #endif - - #ifdef WL_OUTPUT_SCALE_SINCE_VERSION - .scale = waylandOutputScaleListener, - #else - #warning wl_output_listener::scale is not supported - #endif - - #ifdef WL_OUTPUT_NAME_SINCE_VERSION - .name = waylandOutputNameListener, - #else - #warning wl_output_listener::name is not supported - #endif - - #ifdef WL_OUTPUT_DESCRIPTION_SINCE_VERSION - .description = (void*) stubListener, - #else - #warning wl_output_listener::description is not supported - #endif + // Dirty hack for #477 + // The order of these callbacks MUST follow `struct wl_output_listener` + void* outputListener[] = { + waylandOutputGeometryListener, // geometry + waylandOutputModeListener, // mode + stubListener, // done + waylandOutputScaleListener, // scale + waylandOutputNameListener, // name + stubListener, // description }; + static_assert( + sizeof(outputListener) >= sizeof(struct wl_output_listener), + "sizeof(outputListener) is too small. Please report it to fastfetch github issue" + ); wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, &display); wldata->ffwl_display_roundtrip(wldata->display); From 86806b64a251dbd1a1ff27cafb2190fc64584c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 24 Jun 2023 11:47:06 +0800 Subject: [PATCH 33/47] CI (FreeBSD): build with libpulse support --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 26b197503..7211d82b6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -150,7 +150,7 @@ jobs: uses: vmactions/freebsd-vm@v0 with: prepare: | - pkg install -y cmake git pkgconf pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd + pkg install -y cmake git pkgconf pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd pulseaudio run: | cmake -DSET_TWEAK=Off -DBUILD_TESTS=On . cmake --build . --target package From b1b637fe2fe8e647728114036ad6e7e011fec76b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 25 Jun 2023 14:01:50 +0800 Subject: [PATCH 34/47] OS (Windows): code refactor; fix `common/library.h` usage for C++ --- src/common/library.h | 8 ++++---- src/detection/os/os_windows.cpp | 18 +++++------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/common/library.h b/src/common/library.h index a0de3d621..67590ce8f 100644 --- a/src/common/library.h +++ b/src/common/library.h @@ -10,7 +10,7 @@ #include #define FF_DLOPEN_FLAGS 0 FF_C_NODISCARD static inline void* dlopen(const char* path, int mode) { FF_UNUSED(mode); return LoadLibraryA(path); } - FF_C_NODISCARD static inline void* dlsym(void* handle, const char* symbol) { return GetProcAddress((HMODULE)handle, symbol); } + FF_C_NODISCARD static inline void* dlsym(void* handle, const char* symbol) { return (void*) GetProcAddress((HMODULE)handle, symbol); } static inline int dlclose(void* handle) { return !FreeLibrary((HMODULE)handle); } #else #include @@ -40,20 +40,20 @@ static inline void ffLibraryUnload(void** handle) return returnValue; #define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \ - symbolMapping = dlsym(library, #symbolName); \ + symbolMapping = (__typeof__(&symbolName)) dlsym(library, #symbolName); \ if(symbolMapping == NULL) \ return returnValue; #define FF_LIBRARY_LOAD_SYMBOL_ADDRESS2(library, symbolMapping, symbolName, alternateName, returnValue) \ symbolMapping = dlsym(library, #symbolName); \ - if(symbolMapping == NULL && !(symbolMapping = dlsym(library, #alternateName))) \ + if(symbolMapping == NULL && !(symbolMapping = (__typeof__(&symbolName)) dlsym(library, #alternateName))) \ return returnValue; #define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \ __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, returnValue); #define FF_LIBRARY_LOAD_SYMBOL_LAZY(library, symbolName) \ - __typeof__(&symbolName) ff ## symbolName = dlsym(library, #symbolName); + __typeof__(&symbolName) ff ## symbolName = (__typeof__(&symbolName)) dlsym(library, #symbolName); #define FF_LIBRARY_LOAD_SYMBOL_MESSAGE(library, symbolName) \ __typeof__(&symbolName) FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, ff ## symbolName, symbolName, "dlsym " #symbolName " failed"); diff --git a/src/detection/os/os_windows.cpp b/src/detection/os/os_windows.cpp index aa25e90ae..2b18f198d 100644 --- a/src/detection/os/os_windows.cpp +++ b/src/detection/os/os_windows.cpp @@ -1,5 +1,6 @@ extern "C" { #include "os.h" +#include "common/library.h" #include "util/windows/unicode.h" } #include "util/windows/wmi.hpp" @@ -20,27 +21,18 @@ static const char* getOsNameByWmi(FFstrbuf* osName) return "No WMI result returned"; } -static inline void wrapFreeLibrary(HMODULE* module) -{ - if(*module) - FreeLibrary(*module); -} +PWSTR WINAPI BrandingFormatString(PCWSTR format); static const char* getOsNameByWinbrand(FFstrbuf* osName) { //https://dennisbabkin.com/blog/?t=how-to-tell-the-real-version-of-windows-your-app-is-running-on#ver_string - if(HMODULE __attribute__((__cleanup__(wrapFreeLibrary))) hWinbrand = LoadLibraryW(L"winbrand.dll")) - { - auto BrandingFormatString = (PWSTR(WINAPI*)(PCWSTR))(void*)GetProcAddress(hWinbrand, "BrandingFormatString"); - if(!BrandingFormatString) - return "GetProcAddress(BrandingFormatString) failed"; + FF_LIBRARY_LOAD(winbrand, nullptr, "dlopen winbrand" FF_LIBRARY_EXTENSION " failed", "winbrand" FF_LIBRARY_EXTENSION, 1); + FF_LIBRARY_LOAD_SYMBOL_MESSAGE(winbrand, BrandingFormatString); - const wchar_t* rawName = BrandingFormatString(L"%WINDOWS_LONG%"); + const wchar_t* rawName = ffBrandingFormatString(L"%WINDOWS_LONG%"); ffStrbufSetWS(osName, rawName); GlobalFree((HGLOBAL)rawName); return NULL; - } - return "LoadLibraryW(winbrand.dll) failed"; } extern "C" From 8fd30e814a4e17666cce69163e035ce057f336a2 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 25 Jun 2023 23:35:51 +0800 Subject: [PATCH 35/47] GPU (macOS): fix vendor detection for Intel GPU --- src/detection/gpu/gpu_apple.c | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 3cde517c8..528d9fa52 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -63,23 +63,18 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET; gpu->type = FF_GPU_TYPE_UNKNOWN; - ffStrbufInit(&gpu->vendor); - int vendorId; - if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId)) - { - const char* vendorStr = ffGetGPUVendorString((unsigned) vendorId); - ffStrbufAppendS(&gpu->vendor, vendorStr); - if (vendorStr == FF_GPU_VENDOR_NAME_APPLE || vendorStr == FF_GPU_VENDOR_NAME_INTEL) - gpu->type = FF_GPU_TYPE_INTEGRATED; - else if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA || vendorStr == FF_GPU_VENDOR_NAME_AMD) - gpu->type = FF_GPU_TYPE_DISCRETE; - } - - ffStrbufInit(&gpu->driver); + ffStrbufInit(&gpu->driver); // Ok for both Apple and Intel ffCfDictGetString(properties, CFSTR("CFBundleIdentifier"), &gpu->driver); + int vram; // Supported on Intel + if(!ffCfDictGetInt(properties, CFSTR("VRAM,totalMB"), &vram)) + gpu->dedicated.total = (uint64_t) vram * 1024 * 1034; + + if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) // For Apple + gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; + ffStrbufInit(&gpu->name); - //IOAccelerator returns model property for Apple Silicon, but not for Intel Iris GPUs. + //IOAccelerator returns model / vendor-id properties for Apple Silicon, but not for Intel Iris GPUs. //Still needs testing for AMD's if(ffCfDictGetString(properties, CFSTR("model"), &gpu->name)) { @@ -96,8 +91,17 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) ffCfDictGetString(properties, CFSTR("model"), &gpu->name); } - if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) - gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; + ffStrbufInit(&gpu->vendor); + int vendorId; + if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId)) + { + const char* vendorStr = ffGetGPUVendorString((unsigned) vendorId); + ffStrbufAppendS(&gpu->vendor, vendorStr); + if (vendorStr == FF_GPU_VENDOR_NAME_APPLE || vendorStr == FF_GPU_VENDOR_NAME_INTEL) + gpu->type = FF_GPU_TYPE_INTEGRATED; + else if (vendorStr == FF_GPU_VENDOR_NAME_NVIDIA || vendorStr == FF_GPU_VENDOR_NAME_AMD) + gpu->type = FF_GPU_TYPE_DISCRETE; + } if(instance->config.gpuTemp) gpu->temperature = detectGpuTemp(&gpu->name); From c18bcd316dd3ada500192a3a875f773a1708c25f Mon Sep 17 00:00:00 2001 From: Carter Li Date: Sun, 25 Jun 2023 23:40:20 +0800 Subject: [PATCH 36/47] GPU (macOS): fix typo --- src/detection/gpu/gpu_apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 528d9fa52..83dc4f1c1 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -68,7 +68,7 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) int vram; // Supported on Intel if(!ffCfDictGetInt(properties, CFSTR("VRAM,totalMB"), &vram)) - gpu->dedicated.total = (uint64_t) vram * 1024 * 1034; + gpu->dedicated.total = (uint64_t) vram * 1024 * 1024; if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) // For Apple gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; From 2729d72c68747a227f94d4745d629b5de39f73e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 28 Jun 2023 09:39:48 +0800 Subject: [PATCH 37/47] GPU (macOS): remove an unused `#include` --- src/detection/gpu/gpu_apple.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 83dc4f1c1..b37f2f457 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -5,7 +5,6 @@ #include "util/apple/cf_helpers.h" #include -#include static double detectGpuTemp(const FFstrbuf* gpuName) { From 4652002e8c8f46a50a25e76a93b6d3e441276905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 29 Jun 2023 09:43:00 +0800 Subject: [PATCH 38/47] FFPlatform: fix ffPlatformPathAddEnv on Windows --- src/util/platform/FFPlatform.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/platform/FFPlatform.c b/src/util/platform/FFPlatform.c index 2a880aed1..811547c52 100644 --- a/src/util/platform/FFPlatform.c +++ b/src/util/platform/FFPlatform.c @@ -98,7 +98,13 @@ void ffPlatformPathAddEnv(FFlist* dirs, const char* env) uint32_t startIndex = 0; while (startIndex < value.length) { - uint32_t colonIndex = ffStrbufNextIndexC(&value, startIndex, ':'); + #ifdef _WIN32 + const char separator = ';'; + #else + const char separator = ':'; + #endif + + uint32_t colonIndex = ffStrbufNextIndexC(&value, startIndex, separator); value.chars[colonIndex] = '\0'; if(!ffStrSet(value.chars + startIndex)) From 9d4ec4ca65414d76642c1212c3713af68ee96315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 29 Jun 2023 11:26:35 +0800 Subject: [PATCH 39/47] Bios (macOS): support bios date detection --- src/detection/bios/bios_apple.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/detection/bios/bios_apple.c b/src/detection/bios/bios_apple.c index 9d7ff75cc..a28276e96 100644 --- a/src/detection/bios/bios_apple.c +++ b/src/detection/bios/bios_apple.c @@ -48,6 +48,7 @@ void ffDetectBios(FFBiosResult* bios) if(IORegistryEntryCreateCFProperties(registryEntry, &properties, kCFAllocatorDefault, kNilOptions) == kIOReturnSuccess) { ffCfDictGetString(properties, CFSTR("manufacturer"), &bios->biosVendor); + ffCfDictGetString(properties, CFSTR("time-stamp"), &bios->date); CFRelease(properties); } IOObjectRelease(registryEntry); From 5b6416e13c3ffc5a3603f2cd962ae0751b4b6b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 30 Jun 2023 16:34:19 +0800 Subject: [PATCH 40/47] CMake (Windows): remove an unused dependency --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f15b290a3..0f55b1649 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -750,7 +750,6 @@ elseif(WIN32) PRIVATE "setupapi" PRIVATE "hid" PRIVATE "wtsapi32" - PRIVATE "powrprof" ) endif() From b6c5f49650accbb7c016bf2a0bdcd97899cfbb01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 1 Jul 2023 14:47:14 +0800 Subject: [PATCH 41/47] GPU (Windows): more strict check --- src/detection/gpu/gpu_windows.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/detection/gpu/gpu_windows.c b/src/detection/gpu/gpu_windows.c index 671328a1c..3151957e5 100644 --- a/src/detection/gpu/gpu_windows.c +++ b/src/detection/gpu/gpu_windows.c @@ -6,17 +6,17 @@ const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* instance) { - DISPLAY_DEVICEW displayDevice = {.cb = sizeof(displayDevice) }; + DISPLAY_DEVICEW displayDevice = { .cb = sizeof(displayDevice) }; wchar_t regKey[MAX_PATH] = L"SYSTEM\\CurrentControlSet\\Control\\Video\\{"; - const uint32_t regKeyPrefixLength = strlen("SYSTEM\\CurrentControlSet\\Control\\Video\\{"); - const uint32_t deviceKeyPrefixLength = strlen("\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Video\\{"); + const uint32_t regKeyPrefixLength = (uint32_t) wcslen(regKey); + const uint32_t deviceKeyPrefixLength = strlen("\\Registry\\Machine\\") + regKeyPrefixLength; for (DWORD i = 0; EnumDisplayDevicesW(NULL, i, &displayDevice, 0); ++i) { if (displayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) continue; const uint32_t deviceKeyLength = (uint32_t) wcslen(displayDevice.DeviceKey); - if (wmemcmp(&displayDevice.DeviceKey[deviceKeyLength - 4], L"0000", 4) != 0) continue; + if (deviceKeyLength != 100 || wmemcmp(&displayDevice.DeviceKey[deviceKeyLength - 4], L"0000", 4) != 0) continue; FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus); ffStrbufInit(&gpu->vendor); @@ -27,7 +27,7 @@ const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* inst gpu->type = FF_GPU_TYPE_UNKNOWN; gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET; - if (deviceKeyLength == 100 && displayDevice.DeviceKey[deviceKeyPrefixLength - 1] == '{') + if (displayDevice.DeviceKey[deviceKeyPrefixLength - 1] == '{') { wmemcpy(regKey + regKeyPrefixLength, displayDevice.DeviceKey + deviceKeyPrefixLength, 100 - regKeyPrefixLength + 1); FF_HKEY_AUTO_DESTROY hKey = NULL; From ad3b7762a373c139925756a8cb8d9f5ffdee260d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 1 Jul 2023 20:27:04 +0800 Subject: [PATCH 42/47] GPU: fix #484 --- src/detection/gpu/gpu_windows.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/detection/gpu/gpu_windows.c b/src/detection/gpu/gpu_windows.c index 3151957e5..d83da86f7 100644 --- a/src/detection/gpu/gpu_windows.c +++ b/src/detection/gpu/gpu_windows.c @@ -4,6 +4,11 @@ #include +static int isGpuNameEqual(const FFGPUResult* gpu, const FFstrbuf* name) +{ + return ffStrbufEqual(&gpu->name, name); +} + const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* instance) { DISPLAY_DEVICEW displayDevice = { .cb = sizeof(displayDevice) }; @@ -16,7 +21,16 @@ const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* inst if (displayDevice.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) continue; const uint32_t deviceKeyLength = (uint32_t) wcslen(displayDevice.DeviceKey); - if (deviceKeyLength != 100 || wmemcmp(&displayDevice.DeviceKey[deviceKeyLength - 4], L"0000", 4) != 0) continue; + if (__builtin_expect(deviceKeyLength == 100, true)) + { + if (wmemcmp(&displayDevice.DeviceKey[deviceKeyLength - 4], L"0000", 4) != 0) continue; + } + else + { + // DeviceKey can be empty. See #484 + FF_STRBUF_AUTO_DESTROY gpuName = ffStrbufCreateWS(displayDevice.DeviceString); + if (ffListFirstIndexComp(gpus, &gpuName, (void*) isGpuNameEqual) != gpus->length) continue; + } FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus); ffStrbufInit(&gpu->vendor); @@ -27,7 +41,7 @@ const char* ffDetectGPUImpl(FFlist* gpus, FF_MAYBE_UNUSED const FFinstance* inst gpu->type = FF_GPU_TYPE_UNKNOWN; gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET; - if (displayDevice.DeviceKey[deviceKeyPrefixLength - 1] == '{') + if (deviceKeyLength == 100 && displayDevice.DeviceKey[deviceKeyPrefixLength - 1] == '{') { wmemcpy(regKey + regKeyPrefixLength, displayDevice.DeviceKey + deviceKeyPrefixLength, 100 - regKeyPrefixLength + 1); FF_HKEY_AUTO_DESTROY hKey = NULL; From 23c8937362dee95af7b5c727b0ebc0f5b634cda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 2 Jul 2023 10:56:28 +0800 Subject: [PATCH 43/47] fix(Shell): fix shell version printing --- src/detection/terminalshell/terminalshell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index d6a93d17a..7a72faff8 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -40,11 +40,17 @@ static bool getFileVersion(const char* exePath, FFstrbuf* version) static bool getExeVersionRaw(FFstrbuf* exe, FFstrbuf* version) { - return ffProcessAppendStdOut(version, (char* const[]) { + bool ok = ffProcessAppendStdOut(version, (char* const[]) { exe->chars, "--version", NULL }) == NULL; + if (ok) + { + ffStrbufTrim(version, '\n'); + ffStrbufTrim(version, ' '); + } + return ok; } static bool getExeVersionGeneral(FFstrbuf* exe, FFstrbuf* version) From 47ac01c8e102bcb133dd3ac4c0430677f797f537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 2 Jul 2023 11:10:12 +0800 Subject: [PATCH 44/47] Global: fix compiling --- src/util/FFstrbuf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/FFstrbuf.h b/src/util/FFstrbuf.h index d80a99483..6f9f80ce7 100644 --- a/src/util/FFstrbuf.h +++ b/src/util/FFstrbuf.h @@ -121,6 +121,13 @@ static inline void ffStrbufInit(FFstrbuf* strbuf) strbuf->chars = CHAR_NULL_PTR; } +static inline FFstrbuf ffStrbufCreate() +{ + FFstrbuf result; + ffStrbufInit(&result); + return result; +} + static inline void ffStrbufInitNS(FFstrbuf* strbuf, uint32_t length, const char* str) { ffStrbufInit(strbuf); From 11827d64bef9b68aacba66325a8ef85fd390052e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 2 Jul 2023 13:41:11 +0800 Subject: [PATCH 45/47] TerminalShell: fix compiling on macOS --- src/detection/terminalshell/terminalshell_linux.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index e13cd7725..f3255ea31 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -378,9 +378,12 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance) ffStrbufInitS(&result.shellPrettyName, result.shellExeName); } + if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui")) + ffStrbufInitS(&result.terminalPrettyName, "WezTerm"); + #if defined(__linux__) || defined(__FreeBSD__) - if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-")) + else if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-")) ffStrbufInitS(&result.terminalPrettyName, "gnome-terminal"); #elif defined(__APPLE__) @@ -394,8 +397,6 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance) #endif - else if(ffStrbufEqualS(&result.terminalProcessName, "wezterm-gui")) - ffStrbufInitS(&result.terminalPrettyName, "WezTerm"); else if(strncmp(result.terminalExeName, result.terminalProcessName.chars, result.terminalProcessName.length) == 0) // if exeName starts with processName, print it. Otherwise print processName ffStrbufInitS(&result.terminalPrettyName, result.terminalExeName); else From fa8bfd08f9c68c121a0ac2aaec0992303cb4300b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 2 Jul 2023 13:58:11 +0800 Subject: [PATCH 46/47] Release: v1.12.0 --- CHANGELOG.md | 25 ++++++++++++++++++++++++- CMakeLists.txt | 2 +- README.md | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a0b81453..868765a26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,32 @@ -# 1.11.4 +# 1.12.0 + +This release backports some changes from dev branch, and fixes 2 crashing issues Features: * Support KDE / LXQT / MATE / Cinnamon wallpaper detection (Wallpaper, Linux) * Support QTerminal version & terminal font detection * Support MATE Terminal version & terminal font detection +* Set `--pipe true` automatically if stdout is not a tty +* Detect new macs released on WWDC 2023 (macOS, Host) +* Count cached memory as free memory (FreeBSD, Memory) +* Support sound detection (FreeBSD, Sound) + +Bugfixes: +* Fix DE detection on Windows 8.1 (Windows, DE) +* Fix `--logo-padding-left` doesn't work when `--logo-padding-top` is set (Logo) +* Fix KDE version detection on Fedora (DE) +* Include limits.h when needed (Linux, #472) +* Fix Windows drives detection in WSL (Linux, Disk) +* Fix CPU temp detection (FreeBSD, CPU) +* Fix disk detection (Android, Disk) +* Fix Gnome Terminal version and font detection (FreeBSD, TerminalFont) +* Fix crash on newer wayland desktops (Linux, Display, #477) +* Fix vendor detection for Intel GPU (macOS, GPU) +* Fix possible crashes on Windows Server (Windows, GPU, #484) + +Logo: +* Add bsd, freebsd_small, ghostbsd +* Make Windows 11 logo colorable # 1.11.3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f55b1649..4ddc01bd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 1.11.3 + VERSION 1.12.0 LANGUAGES C DESCRIPTION "Fast system information tool" HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch" diff --git a/README.md b/README.md index 1b5945393..37b8779ee 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ Battery, Bios, Bluetooth, Board, Break, Brightness, Colors, Command, CPU, CPUUsa ##### Builtin logos ``` -AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, Crystal, Debian, Deepin, Devuan, Endeavour, Enso, Fedora, FreeBSD, Garuda, Gentoo, KDE Neon, KISS, Kubuntu, LangitKetujuh, Linux, MacOS, Manjaro, Mint, MSYS2, NixOS, Nobara, OpenSUSE, OpenSUSE LEAP, OpenSUSE Tumbleweed, Parabola, Pop!_OS, Raspbian, RebornOS, RedstarOS, Rocky, Rosa, Slackware, Solus, SteamOS, Ubuntu, Vanilla, Void, Windows, Windows 11, Windows 8, Zorin +AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, Crystal, Debian, Deepin, Devuan, Endeavour, Enso, Fedora, FreeBSD, Garuda, Gentoo, GhostBSD, KDE Neon, KISS, Kubuntu, LangitKetujuh, Linux, MacOS, Manjaro, Mint, MSYS2, NixOS, Nobara, OpenSUSE, OpenSUSE LEAP, OpenSUSE Tumbleweed, Parabola, Pop!_OS, Raspbian, RebornOS, RedstarOS, Rocky, Rosa, Slackware, Solus, SteamOS, Ubuntu, Vanilla, Void, Windows, Windows 11, Windows 8, Zorin ``` ##### Package managers From e7474bda1fccf5c6262a3b16886eabf6c966c297 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Mon, 12 Jun 2023 17:26:37 +0200 Subject: [PATCH 47/47] Adapt to new repository url --- .github/workflows/push.yml | 2 +- CMakeLists.txt | 2 +- README.md | 2 +- src/detection/packages/packages_linux.c | 2 +- src/detection/terminalshell/terminalshell_linux.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 7211d82b6..c2bc036fe 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -285,7 +285,7 @@ jobs: path: ./fastfetch-*-Win32.zip release: - if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'LinusDierheimer/fastfetch' + if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'fastfetch-cli/fastfetch' name: Release runs-on: ubuntu-latest needs: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ddc01bd4..bc7fa377e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(fastfetch VERSION 1.12.0 LANGUAGES C DESCRIPTION "Fast system information tool" - HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch" + HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" ) set(PROJECT_LICENSE "MIT license") diff --git a/README.md b/README.md index 37b8779ee..151aa630f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for -There are [screenshots on different platforms](https://github.com/LinusDierheimer/fastfetch/wiki) +There are [screenshots on different platforms](https://github.com/fastfetch-cli/fastfetch/wiki) ## Customization diff --git a/src/detection/packages/packages_linux.c b/src/detection/packages/packages_linux.c index b0b47f37c..4ec9ac043 100644 --- a/src/detection/packages/packages_linux.c +++ b/src/detection/packages/packages_linux.c @@ -135,7 +135,7 @@ static uint32_t getNixPackagesImpl(char* path) FFstrbuf output; ffStrbufInitA(&output, 128); - //https://github.com/LinusDierheimer/fastfetch/issues/195#issuecomment-1191748222 + //https://github.com/fastfetch-cli/fastfetch/issues/195#issuecomment-1191748222 FFstrbuf command; ffStrbufInitA(&command, 255); ffStrbufAppendS(&command, "for x in $(nix-store --query --requisites "); diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index f3255ea31..79b1e584d 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -374,7 +374,7 @@ const FFTerminalShellResult* ffDetectTerminalShell(const FFinstance* instance) ffStrbufInitS(&result.shellPrettyName, "xonsh"); else { - // https://github.com/LinusDierheimer/fastfetch/discussions/280#discussioncomment-3831734 + // https://github.com/fastfetch-cli/fastfetch/discussions/280#discussioncomment-3831734 ffStrbufInitS(&result.shellPrettyName, result.shellExeName); }