From 4db6aebcc92b6f27f7f916f91ff54014be22d95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 1 Jul 2024 23:56:53 +0800 Subject: [PATCH] TerminalFont (Linux): support Ptyxis --- .../terminalfont/terminalfont_linux.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/detection/terminalfont/terminalfont_linux.c b/src/detection/terminalfont/terminalfont_linux.c index f10bcd735..e2bfd5327 100644 --- a/src/detection/terminalfont/terminalfont_linux.c +++ b/src/detection/terminalfont/terminalfont_linux.c @@ -50,6 +50,26 @@ static void detectKgx(FFTerminalFontResult* terminalFont) } } +static void detectPtyxis(FFTerminalFontResult* terminalFont) +{ + if(!ffSettingsGet("/org/gnome/Ptyxis/use-system-font", "org.gnome.Ptyxis", NULL, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue) + { + FF_AUTO_FREE const char* fontName = ffSettingsGet("/org/gnome/Ptyxis/font-name", "org.gnome.Ptyxis", NULL, "font-name", 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.Ptyxis::font-name)"); + } + else + { + FF_AUTO_FREE const char* fontName = getSystemMonospaceFont(); + if(ffStrSet(fontName)) + ffFontInitPango(&terminalFont->font, fontName); + else + ffStrbufAppendS(&terminalFont->error, "Couldn'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; @@ -386,6 +406,8 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont); else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal")) detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont); + else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "ptyxis-agent")) + detectPtyxis(terminalFont); else if(ffStrbufIgnCaseEqualS(&terminal->processName, "kgx")) detectKgx(terminalFont); else if(ffStrbufIgnCaseEqualS(&terminal->processName, "mate-terminal"))