From 6e7652e5be3bf33bd2f7817e12a84548a62bcecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 30 Jul 2023 11:32:44 +0800 Subject: [PATCH] Terminal: support yakuake --- CHANGELOG.md | 1 + README.md | 2 +- src/detection/terminalfont/terminalfont_linux.c | 14 ++++++++++---- src/detection/terminalshell/terminalshell.c | 3 +++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cd2d83e1..aa6b22708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Features: * Add module `Terminal Size` which prints the number of terminal width and height in charactors and pixels * Add new option `--temperature-unit` * Better CPU and Host detection for Android (Android) +* Support yakuake terminal version & font detection (Terminal, Linux) Bugfixes: * Fix possible hanging (TerminalFont, #493) diff --git a/README.md b/README.md index 70da67379..4fee6d926 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Budgie, Cinnamon, Gnome, KDE Plasma, LXQt, Mate, XFCE4 ##### Terminal fonts ``` -Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, MATE Terminal, mintty, QTerminal, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal +Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, MATE Terminal, mintty, QTerminal, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal, Yakuake ``` ## Building diff --git a/src/detection/terminalfont/terminalfont_linux.c b/src/detection/terminalfont/terminalfont_linux.c index d95f94376..6833ba086 100644 --- a/src/detection/terminalfont/terminalfont_linux.c +++ b/src/detection/terminalfont/terminalfont_linux.c @@ -70,14 +70,18 @@ static void detectFromConfigFile(const char* configFile, const char* start, FFTe ffFontInitPango(&terminalFont->font, fontName.chars); } -static void detectKonsole(FFTerminalFontResult* terminalFont) +static void detectKonsole(FFTerminalFontResult* terminalFont, const char* rcFile) { FF_STRBUF_AUTO_DESTROY profile = ffStrbufCreate(); - ffParsePropFileConfig("konsolerc", "DefaultProfile =", &profile); + if(!ffParsePropFileConfig(rcFile, "DefaultProfile =", &profile)) + { + ffStrbufAppendF(&terminalFont->error, "Configuration \".config/%s\" doesn't exist", rcFile); + return; + } if(profile.length == 0) { - ffStrbufAppendS(&terminalFont->error, "Couldn't find \"DefaultProfile=%[^\\n]\" in \".config/konsolerc\""); + ffStrbufAppendS(&terminalFont->error, "Built-in profile is used"); return; } @@ -228,7 +232,9 @@ static void detectXterm(FFTerminalFontResult* terminalFont) void ffDetectTerminalFontPlatform(const FFTerminalShellResult* terminalShell, FFTerminalFontResult* terminalFont) { if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "konsole")) - detectKonsole(terminalFont); + detectKonsole(terminalFont, "konsolerc"); + else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "yakuake")) + detectKonsole(terminalFont, "yakuakerc"); else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "xfce4-terminal")) detectXFCETerminal(terminalFont); else if(ffStrbufIgnCaseEqualS(&terminalShell->terminalProcessName, "lxterminal")) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 86c7f2e67..18a9b79c8 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -309,6 +309,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufIgnCaseEqualS(processName, "konsole")) return getTerminalVersionKonsole(exe, version); + if(ffStrbufIgnCaseEqualS(processName, "yakuake")) + return getExeVersionGeneral(exe, version);//yakuake 22.12.3 + if(ffStrbufIgnCaseEqualS(processName, "xfce4-terminal")) return getExeVersionGeneral(exe, version);//xfce4-terminal 1.0.4 (Xfce 4.18)...