ohmu
·
2026-10-15
1#include "common/font.h"
2#include "terminalfont.h"
3#include "common/settings.h"
4#include "common/properties.h"
5#include "common/parsing.h"
6#include "common/io.h"
7#include "common/processing.h"
8#include "common/mallocHelper.h"
9#include "common/strutil.h"
10#include "common/binary.h"
11#include "detection/terminalshell/terminalshell.h"
12#include "detection/displayserver/displayserver.h"
13
14static const char* getSystemMonospaceFont(void) {
15 const FFDisplayServerResult* wmde = ffConnectDisplayServer();
16
17 if (ffStrbufIgnCaseEqualS(&wmde->dePrettyName, "Cinnamon")) {
18 const char* systemMonospaceFont = ffSettingsGetGnome("/org/cinnamon/desktop/interface/monospace-font-name", "org.cinnamon.desktop.interface", nullptr, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
19 if (ffStrSet(systemMonospaceFont)) {
20 return systemMonospaceFont;
21 }
22 } else if (ffStrbufIgnCaseEqualS(&wmde->dePrettyName, "Mate")) {
23 const char* systemMonospaceFont = ffSettingsGetGnome("/org/mate/interface/monospace-font-name", "org.mate.interface", nullptr, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
24 if (ffStrSet(systemMonospaceFont)) {
25 return systemMonospaceFont;
26 }
27 }
28
29 return ffSettingsGetGnome("/org/gnome/desktop/interface/monospace-font-name", "org.gnome.desktop.interface", nullptr, "monospace-font-name", FF_VARIANT_TYPE_STRING).strValue;
30}
31
32static void detectKgx(FFTerminalFontResult* terminalFont) {
33 // kgx (gnome console) doesn't support profiles
34 if (!ffSettingsGetGnome("/org/gnome/Console/use-system-font", "org.gnome.Console", nullptr, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue) {
35 FF_AUTO_FREE const char* fontName = ffSettingsGetGnome("/org/gnome/Console/custom-font", "org.gnome.Console", nullptr, "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 FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
43 if (ffStrSet(fontName)) {
44 ffFontInitPango(&terminalFont->font, fontName);
45 } else {
46 ffStrbufAppendS(&terminalFont->error, "Couldn't get system monospace font name from GSettings / DConf");
47 }
48 }
49}
50
51static void detectPtyxis(FFTerminalFontResult* terminalFont) {
52 if (!ffSettingsGetGnome("/org/gnome/Ptyxis/use-system-font", "org.gnome.Ptyxis", nullptr, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue) {
53 FF_AUTO_FREE const char* fontName = ffSettingsGetGnome("/org/gnome/Ptyxis/font-name", "org.gnome.Ptyxis", nullptr, "font-name", FF_VARIANT_TYPE_STRING).strValue;
54 if (ffStrSet(fontName)) {
55 ffFontInitPango(&terminalFont->font, fontName);
56 } else {
57 ffStrbufAppendF(&terminalFont->error, "Couldn't get terminal font from GSettings (org.gnome.Ptyxis::font-name)");
58 }
59 } else {
60 FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
61 if (ffStrSet(fontName)) {
62 ffFontInitPango(&terminalFont->font, fontName);
63 } else {
64 ffStrbufAppendS(&terminalFont->error, "Couldn't get system monospace font name from GSettings / DConf");
65 }
66 }
67}
68
69static void detectFromGSettings(const char* profilePath, const char* profileList, const char* profile, const char* defaultProfileKey, FFTerminalFontResult* terminalFont) {
70 FF_AUTO_FREE const char* defaultProfile = ffSettingsGetGSettings(profileList, nullptr, defaultProfileKey, FF_VARIANT_TYPE_STRING).strValue;
71 if (!ffStrSet(defaultProfile)) {
72 ffStrbufAppendF(&terminalFont->error, "Could not get default profile from gsettings: %s", profileList);
73 return;
74 }
75
76 FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateA(128);
77 ffStrbufAppendS(&path, profilePath);
78 ffStrbufAppendS(&path, defaultProfile);
79 ffStrbufAppendC(&path, '/');
80
81 if (!ffSettingsGetGSettings(profile, path.chars, "use-system-font", FF_VARIANT_TYPE_BOOL).boolValue) {
82 FF_AUTO_FREE const char* fontName = ffSettingsGetGSettings(profile, path.chars, "font", FF_VARIANT_TYPE_STRING).strValue;
83 if (ffStrSet(fontName)) {
84 ffFontInitPango(&terminalFont->font, fontName);
85 } else {
86 ffStrbufAppendF(&terminalFont->error, "Couldn't get terminal font from GSettings (%s::%s::font)", profile, path.chars);
87 }
88 } else {
89 FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
90 if (ffStrSet(fontName)) {
91 ffFontInitPango(&terminalFont->font, fontName);
92 } else {
93 ffStrbufAppendS(&terminalFont->error, "Couldn't get system monospace font name from GSettings / DConf");
94 }
95 }
96}
97
98static void detectFromConfigFile(const char* configFile, const char* start, FFTerminalFontResult* terminalFont) {
99 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
100 ffParsePropFileConfig(configFile, start, &fontName);
101
102 if (fontName.length == 0) {
103 ffStrbufAppendF(&terminalFont->error, "Couldn't find %s in .config/%s", start, configFile);
104 } else {
105 ffFontInitPango(&terminalFont->font, fontName.chars);
106 }
107}
108
109static void detectKonsole(FFTerminalFontResult* terminalFont, const char* rcFile) {
110 FF_STRBUF_AUTO_DESTROY profile = ffStrbufCreate();
111 if (!ffParsePropFileConfig(rcFile, "DefaultProfile =", &profile)) {
112 ffStrbufAppendF(&terminalFont->error, "Configuration \".config/%s\" doesn't exist", rcFile);
113 return;
114 }
115
116 if (profile.length == 0) {
117 ffStrbufAppendS(&terminalFont->error, "Built-in profile is used");
118 return;
119 }
120
121 FF_STRBUF_AUTO_DESTROY profilePath = ffStrbufCreateA(32);
122 ffStrbufAppendS(&profilePath, "konsole/");
123 ffStrbufAppend(&profilePath, &profile);
124
125 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
126 ffParsePropFileData(profilePath.chars, "Font =", &fontName);
127
128 if (fontName.length == 0) {
129 ffStrbufAppendF(&terminalFont->error, "Couldn't find \"Font=%%[^\\n]\" in \"%s\"", profilePath.chars);
130 } else {
131 ffFontInitQt(&terminalFont->font, fontName.chars);
132 }
133}
134
135static void detectXFCETerminal(FFTerminalFontResult* terminalFont) {
136 FF_STRBUF_AUTO_DESTROY useSysFont = ffStrbufCreate();
137 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
138
139 const char* path = "xfce4/xfconf/xfce-perchannel-xml/xfce4-terminal.xml";
140 bool configFound = ffParsePropFileConfigValues(path, 2, (FFpropquery[]) { { "<property name=\"font-use-system\" type=\"bool\" value=\"", &useSysFont }, { "<property name=\"font-name\" type=\"string\" value=\"", &fontName } });
141
142 if (configFound) {
143 ffStrbufSubstrBeforeLastC(&useSysFont, '"');
144 ffStrbufSubstrBeforeLastC(&fontName, '"');
145 } else {
146 path = "xfce4/terminal/terminalrc";
147 configFound = ffParsePropFileConfigValues(path, 2, (FFpropquery[]) { { "FontUseSystem = ", &useSysFont }, { "FontName = ", &fontName } });
148 }
149
150 if (configFound && (useSysFont.length == 0 || ffStrbufIgnCaseEqualS(&useSysFont, "false"))) {
151 if (fontName.length == 0) {
152 ffStrbufAppendF(&terminalFont->error, "Couldn't find FontName in %s", path);
153 } else {
154 ffFontInitPango(&terminalFont->font, fontName.chars);
155 }
156 } else {
157 const char* systemFontName = ffSettingsGetXFConf("xsettings", "/Gtk/MonospaceFontName", FF_VARIANT_TYPE_STRING).strValue;
158 if (ffStrSet(systemFontName)) {
159 ffFontInitPango(&terminalFont->font, systemFontName);
160 } else {
161 ffStrbufAppendS(&terminalFont->error, "Couldn't find xsettings::/Gtk/MonospaceFontName in XFConf");
162 }
163 }
164}
165
166static void detectDeepinTerminal(FFTerminalFontResult* terminalFont) {
167 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
168 FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();
169
170 FF_STRBUF_AUTO_DESTROY profile = ffStrbufCreateA(64);
171 ffSearchUserConfigFile(&instance.state.platform.configDirs, "deepin/deepin-terminal/config.conf", &profile);
172 FF_AUTO_CLOSE_FILE FILE* file = fopen(profile.chars, "r");
173
174 if (file) {
175 FF_AUTO_FREE char* line = nullptr;
176 size_t len = 0;
177
178 for (int count = 0; getline(&line, &len, file) != -1 && count < 2;) {
179 if (ffStrEquals(line, "[basic.interface.font]\n")) {
180 if (getline(&line, &len, file) != -1) {
181 ffParsePropLine(line, "value=", &fontName);
182 }
183 ++count;
184 } else if (ffStrEquals(line, "[basic.interface.font_size]\n")) {
185 if (getline(&line, &len, file) != -1) {
186 ffParsePropLine(line, "value=", &fontSize);
187 }
188 ++count;
189 }
190 }
191 }
192
193 if (fontName.length == 0) {
194 ffStrbufAppendS(&fontName, "Noto Sans Mono");
195 }
196 if (fontSize.length == 0) {
197 ffStrbufAppendS(&fontSize, "11");
198 }
199
200 ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);
201}
202
203static void detectFootTerminal(FFTerminalFontResult* terminalFont) {
204 FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
205
206 if (!ffParsePropFileConfig("foot/foot.ini", "font=", &font) || !ffStrSet(font.chars)) {
207 ffFontInitValues(&terminalFont->font, "monospace", "8");
208 return;
209 }
210
211 // foot splits the font list on commas to specify fallback fonts.
212 // Each entry is a fontconfig pattern, e.g. "Berkeley Mono-12" or "Sarasa Term SC Nerd:size=8".
213 uint32_t comma = ffStrbufFirstIndexC(&font, ',');
214 if (comma != font.length) {
215 if (comma + 1 < font.length) {
216 ffFontInitXft(&terminalFont->fallback, &font.chars[comma + 1]);
217 }
218 font.chars[comma] = '\0';
219 ffStrbufRecalculateLength(&font);
220 }
221 ffFontInitXft(&terminalFont->font, font.chars);
222}
223
224static void detectQTerminal(FFTerminalFontResult* terminalFont) {
225 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
226 FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();
227
228 ffParsePropFileConfigValues("qterminal.org/qterminal.ini", 2, (FFpropquery[]) {
229 { "fontFamily=", &fontName },
230 { "fontSize=", &fontSize },
231 });
232
233 if (fontName.length == 0) {
234 ffStrbufAppendS(&fontName, "monospace");
235 }
236 if (fontSize.length == 0) {
237 ffStrbufAppendS(&fontSize, "12");
238 }
239 ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);
240}
241
242static void detectXterm(FFTerminalFontResult* terminalFont) {
243 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
244 FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();
245
246 ffParsePropFileHomeValues(".Xresources", 2, (FFpropquery[]) {
247 { "xterm*faceName:", &fontName },
248 { "xterm*faceSize:", &fontSize },
249 });
250
251 if (fontName.length == 0) {
252 ffParsePropFileHomeValues(".Xresources", 2, (FFpropquery[]) {
253 { "xterm.vt100.faceName:", &fontName },
254 { "xterm.vt100.faceSize:", &fontSize },
255 });
256 }
257
258 if (fontName.length == 0) {
259 ffStrbufAppendS(&fontName, "fixed");
260 }
261 if (fontSize.length == 0) {
262 ffStrbufAppendS(&fontSize, "8.0");
263 }
264 ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);
265}
266
267static bool extractStTermFont(const char* str, [[maybe_unused]] uint32_t len, void* userdata) {
268 if (!ffStrContains(str, "size=")) {
269 return true;
270 }
271 ffStrbufSetNS((FFstrbuf*) userdata, len, str);
272 return false;
273}
274
275static void detectSt(FFTerminalFontResult* terminalFont, const FFTerminalResult* terminal) {
276 FF_STRBUF_AUTO_DESTROY size = ffStrbufCreateF("/proc/%u/cmdline", terminal->pid);
277 FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
278 if (!ffAppendFileBuffer(size.chars, &font)) {
279 ffStrbufAppendF(&terminalFont->error, "Failed to open %s", size.chars);
280 return;
281 }
282
283 const char* p = memmem(font.chars, font.length, "\0-f", sizeof("\0-f")); // find parameter of `-f`
284 if (p) {
285 // st was executed with `-f` parameter
286 ffStrbufSubstrAfter(&font, (uint32_t) (p + (sizeof("\0-f") - 1) - font.chars));
287 ffStrbufRecalculateLength(&font);
288 } else {
289 ffStrbufClear(&font);
290
291 const char* error = ffBinaryExtractStrings(terminal->exePath.chars, extractStTermFont, &font, (uint32_t) strlen("size=0"));
292 if (error) {
293 ffStrbufAppendS(&terminalFont->error, error);
294 return;
295 }
296 if (font.length == 0) {
297 ffStrbufAppendS(&terminalFont->error, "No font config found in st binary");
298 return;
299 }
300 }
301
302 // e.g. "JetBrainsMono Nerd Font Mono:pixelsize=12:antialias=true:autohint=true"
303 ffFontInitXft(&terminalFont->font, font.chars);
304}
305
306static void detectWarp(FFTerminalFontResult* terminalFont) {
307 FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
308
309 FF_LIST_FOR_EACH (FFstrbuf, dirPrefix, instance.state.platform.configDirs) {
310 // We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
311 ffStrbufSet(&baseDir, dirPrefix);
312 ffStrbufAppendS(&baseDir, "warp-terminal/user_preferences.json");
313
314 yyjson_doc* doc = yyjson_read_file(baseDir.chars, YYJSON_READ_INSITU | YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_COMMENTS, nullptr, nullptr);
315 if (!doc) {
316 continue;
317 }
318
319 yyjson_val* prefs = yyjson_obj_get(yyjson_doc_get_root(doc), "prefs");
320 if (yyjson_is_obj(prefs)) {
321 const char* fontName = yyjson_get_str(yyjson_obj_get(prefs, "FontName"));
322 if (!fontName) {
323 fontName = "Hack";
324 }
325 const char* fontSize = yyjson_get_str(yyjson_obj_get(prefs, "FontSize"));
326 if (!fontSize) {
327 fontSize = "13";
328 }
329
330 ffFontInitValues(&terminalFont->font, fontName, fontSize);
331 }
332 yyjson_doc_free(doc);
333 return;
334 }
335}
336
337static void detectTerminator(FFTerminalFontResult* result) {
338 FF_STRBUF_AUTO_DESTROY useSystemFont = ffStrbufCreate();
339 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
340
341 if (!ffParsePropFileConfigValues("terminator/config", 2, (FFpropquery[]) {
342 { "use_system_font =", &useSystemFont },
343 { "font =", &fontName },
344 }) ||
345 ffStrbufIgnCaseEqualS(&useSystemFont, "True")) {
346 FF_AUTO_FREE const char* fontName = getSystemMonospaceFont();
347 if (ffStrSet(fontName)) {
348 ffFontInitPango(&result->font, fontName);
349 } else {
350 ffStrbufAppendS(&result->error, "Couldn't get system monospace font name from GSettings / DConf");
351 }
352 return;
353 }
354
355 if (fontName.length == 0) {
356 ffFontInitValues(&result->font, "Mono", "10");
357 } else {
358 ffFontInitPango(&result->font, fontName.chars);
359 }
360}
361
362static void detectWestonTerminal(FFTerminalFontResult* terminalFont) {
363 FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
364 FF_STRBUF_AUTO_DESTROY size = ffStrbufCreate();
365 ffParsePropFileConfigValues("weston.ini", 2, (FFpropquery[]) {
366 { "font=", &font },
367 { "font-size=", &size },
368 });
369 if (!font.length) {
370 ffStrbufSetStatic(&font, "DejaVu Sans Mono");
371 }
372 if (!size.length) {
373 ffStrbufSetStatic(&size, "14");
374 }
375 ffFontInitValues(&terminalFont->font, font.chars, size.chars);
376}
377
378static void detectKmscon(FFTerminalFontResult* terminalFont) {
379 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
380 FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();
381
382 ffParsePropFileConfigValues("kmscon/kmscon.conf", 2, (FFpropquery[]){
383 { "font-size=", &fontSize },
384 { "font-name=", &fontName },
385 });
386
387 if (fontName.length == 0) {
388 ffStrbufSetStatic(&fontName, "Hack Nerd Font");
389 }
390 if (fontSize.length == 0) {
391 ffStrbufSetStatic(&fontSize, "18");
392 }
393 ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);
394}
395
396static void detectUrxvt(FFTerminalFontResult* terminalFont) {
397 FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
398
399 if (!(ffParsePropFileHomeValues(".Xresources", 1, (FFpropquery[]) {
400 { "URxvt.font:", &buffer },
401 }) ||
402 ffParsePropFileHomeValues(".Xdefaults", 1, (FFpropquery[]) {
403 { "URxvt.font:", &buffer },
404 }))) {
405 ffStrbufAppendS(&terminalFont->error, "Could not find URxvt.font in .Xresources or .Xdefaults");
406 return;
407 }
408
409 uint32_t index = 0;
410
411 char* line = nullptr;
412 size_t len = 0;
413 while (ffStrbufGetdelim(&line, &len, ',', &buffer)) {
414 FFfont* font = index == 0 ? &terminalFont->font : &terminalFont->fallback;
415 if (line[0] == '-') {
416 ffFontInitXlfd(font, line);
417 } else if (ffStrStartsWith(line, "xft:")) {
418 ffFontInitXft(font, line + 4);
419 } else {
420 ffStrbufAppendF(&terminalFont->error, "Unknown URxvt font format: %s", line);
421 continue;
422 }
423 index++;
424 if (index > 1) {
425 break;
426 }
427 }
428}
429
430static bool detectCosmicTerm(FFTerminalFontResult* terminalFont) {
431 FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
432 FF_STRBUF_AUTO_DESTROY fontSize = ffStrbufCreate();
433
434 FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateCopy(&instance.state.platform.homeDir);
435 ffStrbufAppendS(&path, ".config/cosmic/com.system76.CosmicTerm/v1/");
436 uint32_t baseLen = path.length;
437
438 ffStrbufAppendS(&path, "font_name");
439 ffReadFileBuffer(path.chars, &fontName);
440 ffStrbufTrim(&path, '"');
441 ffStrbufSubstrBefore(&path, baseLen);
442 if (fontName.length == 0) {
443 ffStrbufSetStatic(&fontName, "Noto Sans Mono");
444 }
445
446 ffStrbufAppendS(&path, "font_size");
447 if (ffReadFileBuffer(path.chars, &fontSize)) {
448 ffStrbufAppendS(&fontSize, "px");
449 }
450 ffStrbufSubstrBefore(&path, baseLen);
451 if (fontSize.length == 0) {
452 ffStrbufSetStatic(&fontSize, "14px");
453 }
454
455 ffFontInitValues(&terminalFont->font, fontName.chars, fontSize.chars);
456
457 return true;
458}
459
460#ifdef __HAIKU__
461static void detectHaikuTerminal(FFTerminalFontResult* terminalFont) {
462 FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
463 FF_STRBUF_AUTO_DESTROY size = ffStrbufCreate();
464 ffParsePropFileConfigValues("Terminal/Default", 2, (FFpropquery[]) {
465 { "\"Half Font Family\" , ", &font },
466 { "\"Half Font Size\" , ", &size },
467 });
468 if (!font.length) {
469 ffStrbufSetStatic(&font, "Noto Sans Mono");
470 }
471 if (!size.length) {
472 ffStrbufSetStatic(&size, "12");
473 }
474 ffFontInitValues(&terminalFont->font, font.chars, size.chars);
475}
476#endif
477
478bool
479#ifdef __ANDROID__
480ffDetectTerminalFontPlatformLinux
481#else
482ffDetectTerminalFontPlatform
483#endif
484 (const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont) {
485 if (ffStrbufIgnCaseEqualS(&terminal->processName, "konsole")) {
486 detectKonsole(terminalFont, "konsolerc");
487 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "yakuake")) {
488 detectKonsole(terminalFont, "yakuakerc");
489 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "xfce4-terminal")) {
490 detectXFCETerminal(terminalFont);
491 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "lxterminal")) {
492 detectFromConfigFile("lxterminal/lxterminal.conf", "fontname =", terminalFont);
493 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "tilix")) {
494 detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont);
495 } else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal")) {
496 detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont);
497 } else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "ptyxis-agent")) {
498 detectPtyxis(terminalFont);
499 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "kgx")) {
500 detectKgx(terminalFont);
501 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "mate-terminal")) {
502 detectFromGSettings("/org/mate/terminal/profiles/", "org.mate.terminal.global", "org.mate.terminal.profile", "default-profile", terminalFont);
503 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "deepin-terminal")) {
504 detectDeepinTerminal(terminalFont);
505 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "foot")) {
506 detectFootTerminal(terminalFont);
507 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "qterminal")) {
508 detectQTerminal(terminalFont);
509 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "xterm")) {
510 detectXterm(terminalFont);
511 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "st")) {
512 detectSt(terminalFont, terminal);
513 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "warp")) {
514 detectWarp(terminalFont);
515 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "weston-terminal")) {
516 detectWestonTerminal(terminalFont);
517 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "kmscon")) {
518 detectKmscon(terminalFont);
519 } else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "terminator")) {
520 detectTerminator(terminalFont);
521 } else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "sakura")) {
522 detectFromConfigFile("sakura/sakura.conf", "font=", terminalFont);
523 } else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "cosmic-term")) {
524 detectCosmicTerm(terminalFont);
525 }
526#ifdef __HAIKU__
527 else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "Terminal")) {
528 detectHaikuTerminal(terminalFont);
529 }
530#endif
531 else if (ffStrbufStartsWithIgnCaseS(&terminal->processName, "termite")) {
532 detectFromConfigFile("termite/config", "font =", terminalFont);
533 } else if (ffStrbufIgnCaseEqualS(&terminal->processName, "rxvt") || ffStrbufIgnCaseEqualS(&terminal->processName, "urxvt") || ffStrbufIgnCaseEqualS(&terminal->processName, "urxvtd")) {
534 detectUrxvt(terminalFont);
535 } else {
536 return false;
537 }
538 return true;
539}