@@ -27,6 +27,27 @@ static const char* getSystemMonospaceFont(void)
2727 return ffSettingsGet ("/org/gnome/desktop/interface/monospace-font-name" , "org.gnome.desktop.interface" , NULL , "monospace-font-name" , FF_VARIANT_TYPE_STRING ).strValue ;
2828}
2929
30+ static void detectKgx (FFTerminalFontResult * terminalFont )
31+ {
32+ // kgx (gnome terminal) doesn't support profiles
33+ if (!ffSettingsGet ("/org/gnome/Console/use-system-font" , "org.gnome.Console" , NULL , "use-system-font" , FF_VARIANT_TYPE_BOOL ).boolValue )
34+ {
35+ FF_AUTO_FREE const char * fontName = ffSettingsGet ("/org/gnome/Console/custom-font" , "org.gnome.Console" , NULL , "custom-font" , FF_VARIANT_TYPE_STRING ).strValue ;
36+ if (ffStrSet (fontName ))
37+ ffFontInitPango (& terminalFont -> font , fontName );
38+ else
39+ ffStrbufAppendF (& terminalFont -> error , "Couldn't get terminal font from GSettings (org.gnome.Console::custom-font)" );
40+ }
41+ else
42+ {
43+ FF_AUTO_FREE const char * fontName = getSystemMonospaceFont ();
44+ if (ffStrSet (fontName ))
45+ ffFontInitPango (& terminalFont -> font , fontName );
46+ else
47+ ffStrbufAppendS (& terminalFont -> error , "Could't get system monospace font name from GSettings / DConf" );
48+ }
49+ }
50+
3051static void detectFromGSettings (const char * profilePath , const char * profileList , const char * profile , const char * defaultProfileKey , FFTerminalFontResult * terminalFont )
3152{
3253 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
5172 }
5273 else
5374 {
54- const char * fontName = getSystemMonospaceFont ();
75+ FF_AUTO_FREE const char * fontName = getSystemMonospaceFont ();
5576 if (ffStrSet (fontName ))
5677 ffFontInitPango (& terminalFont -> font , fontName );
5778 else
@@ -243,6 +264,8 @@ void ffDetectTerminalFontPlatform(const FFTerminalShellResult* terminalShell, FF
243264 detectFromGSettings ("/com/gexperts/Tilix/profiles/" , "com.gexperts.Tilix.ProfilesList" , "com.gexperts.Tilix.Profile" , "default" , terminalFont );
244265 else if (ffStrbufStartsWithIgnCaseS (& terminalShell -> terminalProcessName , "gnome-terminal-" ))
245266 detectFromGSettings ("/org/gnome/terminal/legacy/profiles:/:" , "org.gnome.Terminal.ProfilesList" , "org.gnome.Terminal.Legacy.Profile" , "default" , terminalFont );
267+ else if (ffStrbufIgnCaseEqualS (& terminalShell -> terminalProcessName , "kgx" ))
268+ detectKgx (terminalFont );
246269 else if (ffStrbufIgnCaseEqualS (& terminalShell -> terminalProcessName , "mate-terminal" ))
247270 detectFromGSettings ("/org/mate/terminal/profiles/" , "org.mate.terminal.global" , "org.mate.terminal.profile" , "default-profile" , terminalFont );
248271 else if (ffStrbufIgnCaseEqualS (& terminalShell -> terminalProcessName , "deepin-terminal" ))
0 commit comments