mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
@@ -27,6 +27,27 @@ static const char* getSystemMonospaceFont(void)
|
||||
return ffSettingsGet("/org/gnome/desktop/interface/monospace-font-name", "org.gnome.desktop.interface", NULL, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
|
||||
}
|
||||
|
||||
static void detectKgx(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
// kgx (gnome terminal) doesn't support profiles
|
||||
if(!ffSettingsGet("/org/gnome/Console/use-system-font", "org.gnome.Console", NULL, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue)
|
||||
{
|
||||
FF_AUTO_FREE const char* fontName = ffSettingsGet("/org/gnome/Console/custom-font", "org.gnome.Console", NULL, "custom-font", FF_VARIANT_TYPE_STRING).strValue;
|
||||
if(ffStrSet(fontName))
|
||||
ffFontInitPango(&terminalFont->font, fontName);
|
||||
else
|
||||
ffStrbufAppendF(&terminalFont->error, "Couldn't get terminal font from GSettings (org.gnome.Console::custom-font)");
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
|
||||
if(ffStrSet(fontName))
|
||||
ffFontInitPango(&terminalFont->font, fontName);
|
||||
else
|
||||
ffStrbufAppendS(&terminalFont->error, "Could't get system monospace font name from GSettings / DConf");
|
||||
}
|
||||
}
|
||||
|
||||
static void detectFromGSettings(const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_AUTO_FREE const char* defaultProfile = ffSettingsGetGSettings(profileList, NULL, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue;
|
||||
@@ -51,7 +72,7 @@ static void detectFromGSettings(const char* profilePath, const char* profileList
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* fontName = getSystemMonospaceFont();
|
||||
FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
|
||||
if(ffStrSet(fontName))
|
||||
ffFontInitPango(&terminalFont->font, fontName);
|
||||
else
|
||||
@@ -243,6 +264,8 @@ void ffDetectTerminalFontPlatform(const FFTerminalShellResult* terminalShell, FF
|
||||
detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&terminalShell->terminalProcessName, "gnome-terminal-"))
|
||||
detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "kgx"))
|
||||
detectKgx(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "mate-terminal"))
|
||||
detectFromGSettings("/org/mate/terminal/profiles/", "org.mate.terminal.global", "org.mate.terminal.profile", "default-profile", terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "deepin-terminal"))
|
||||
|
||||
@@ -206,6 +206,20 @@ FF_MAYBE_UNUSED static bool getTerminalVersionGnome(FFstrbuf* version)
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionKgx(FFstrbuf* version)
|
||||
{
|
||||
if(ffProcessAppendStdOut(version, (char* const[]){
|
||||
"gnome-terminal",
|
||||
"--version",
|
||||
NULL
|
||||
})) return false;
|
||||
|
||||
//# KGX 45.0 using VTE 0.74.0 +BIDI +GNUTLS +ICU +SYSTEMD
|
||||
ffStrbufSubstrAfterFirstS(version, "KGX ");
|
||||
ffStrbufSubstrBeforeFirstC(version, ' ');
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionKonsole(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
const char* konsoleVersion = getenv("KONSOLE_VERSION");
|
||||
|
||||
@@ -385,7 +385,9 @@ const FFTerminalShellResult* ffDetectTerminalShell()
|
||||
#elif defined(__linux__) || defined(__FreeBSD__)
|
||||
|
||||
else if(ffStrbufStartsWithS(&result.terminalProcessName, "gnome-terminal-"))
|
||||
ffStrbufInitStatic(&result.terminalPrettyName, "gnome-terminal");
|
||||
ffStrbufInitStatic(&result.terminalPrettyName, "GNOME Terminal");
|
||||
else if(ffStrbufStartsWithS(&result.terminalProcessName, "kgx"))
|
||||
ffStrbufInitStatic(&result.terminalPrettyName, "GNOME Console");
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user