Skip to content

Commit 494cc14

Browse files
committed
TerminalFont (Linux): support xfce4-terminal 1.1.0+
Fixes #602
1 parent 761c649 commit 494cc14

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Features:
2222
* Support urxvt version detection (Terminal, Linux)
2323
* Support st version detection (Terminal, Linux)
2424
* Support st terminal font detection (TerminalFont, Linux)
25+
* Support xfce4-terminal 1.1.0+ terminal font detection (TerminalFont, Linux)
2526
* Add option `--migrate-config <?target-file-path>`
2627
* Support Nvidia GPU temp and cuda core count detection via nvml. Use `--gpu-use-nvml` to enable it (GPU)
2728
* Try supporting Wifi authentication type detection in macOS Sonoma. Please file a feature request if you get `to be supported (num)` with result of `/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep auth` (Wifi, macOS)

src/detection/terminalfont/terminalfont_linux.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,33 @@ static void detectXFCETerminal(FFTerminalFontResult* terminalFont)
125125
FF_STRBUF_AUTO_DESTROY useSysFont = ffStrbufCreate();
126126
FF_STRBUF_AUTO_DESTROY fontName = ffStrbufCreate();
127127

128-
ffParsePropFileConfigValues("xfce4/terminal/terminalrc", 2, (FFpropquery[]) {
129-
{"FontUseSystem = ", &useSysFont},
130-
{"FontName = ", &fontName}
128+
const char* path = "xfce4/xfconf/xfce-perchannel-xml/xfce4-terminal.xml";
129+
bool configFound = ffParsePropFileConfigValues(path, 2, (FFpropquery[]) {
130+
{"<property name=\"font-use-system\" type=\"bool\" value=\"", &useSysFont},
131+
{"<property name=\"font-name\" type=\"string\" value=\"", &fontName}
131132
});
132133

134+
if (configFound)
135+
{
136+
ffStrbufSubstrBeforeLastC(&useSysFont, '"');
137+
ffStrbufSubstrBeforeLastC(&fontName, '"');
138+
}
139+
else
140+
{
141+
path = "xfce4/terminal/terminalrc";
142+
configFound = ffParsePropFileConfigValues(path, 2, (FFpropquery[]) {
143+
{"FontUseSystem = ", &useSysFont},
144+
{"FontName = ", &fontName}
145+
});
146+
}
147+
148+
if (!configFound)
149+
ffStrbufSetStatic(&terminalFont->error, "Couldn't find xfce4/xfconf/xfce-perchannel-xml/xfce4-terminal.xml or xfce4/terminal/terminalrc");
150+
133151
if(useSysFont.length == 0 || ffStrbufIgnCaseCompS(&useSysFont, "false") == 0)
134152
{
135153
if(fontName.length == 0)
136-
ffStrbufAppendS(&terminalFont->error, "Couldn't find FontName in .config/xfce4/terminal/terminalrc");
154+
ffStrbufAppendF(&terminalFont->error, "Couldn't find FontName in %s", path);
137155
else
138156
ffFontInitPango(&terminalFont->font, fontName.chars);
139157
}

0 commit comments

Comments
 (0)