Global: review code

This commit is contained in:
李通洲
2024-01-17 15:06:52 +08:00
parent 9f77851176
commit b3945e277c
8 changed files with 19 additions and 39 deletions
+4 -2
View File
@@ -6,24 +6,26 @@ Changes:
Features:
* Add `ENABLE_PROPRIETARY_GPU_DRIVER_API` cmake option to disable using of proprietary GPU driver APIs (GPU)
* Support wallpaper detection for macOS Sonoma (Wallpaper, macOS)
* Support power adapter detection for Asahi Linux (PowerAdapter, Linux)
* Support battery serial number and manufacturer date detection (Battery)
* Support host serial number and UUID detection (Host)
* Support battery level detection for gamepads where possible (Gamepad)
* Support maximum CPU clock detection. Previously base clock was printed (CPU, Windows)
* Support manufacture date and serial number detection for physical monitors (Monitor)
* Support ash shell version detection (Shell, Linux)
* Support ash (default shell of BusyBox) version detection (Shell, Linux)
* Sound module in FreeBSD now uses native `ioctl`s. Pulseaudio dependency is no longer used.
* Locale module in Windows now prints the same format as in Linux and other posix systems.
Bugfixes:
* Fix support of macOS Sonoma (Wallpaper, macOS)
* Fix overall memory leaks (macOS)
* Remove trailing `\0` in JSON results (FreeBSD)
* Fix physical monitor detection with Nvidia drivers (Monitor, Linux)
* Don't print llvmpipe in vulkan module (Vulkan)
* Fix system yyjson usage in `fastfetch.c`. Previously embedded `3rdparty/yyjson/yyjson.h` was used in `fastfetch.c` even if `ENABLE_SYSTEM_YYJSON` was set (CMake)
* Fix locale module printing unexpected results in specific environments (Locale)
* Fix battery temperature detection in Windows. Note only smart batteries report temperatures but few laptops uses smart battery (Battery, Windows)
* Print device name if no backlight name is available, so we don't print empty parentheses (Brightness, FreeBSD)
# 2.5.0
+4 -22
View File
@@ -676,6 +676,10 @@
"const": "gamepad",
"description": "List connected gamepads"
},
{
"const": "host",
"description": "Print product name of your computer"
},
{
"const": "icons",
"description": "Print icon style name"
@@ -1212,28 +1216,6 @@
},
"additionalProperties": false
},
{
"title": "Host",
"properties": {
"type": {
"const": "host",
"description": "Print product name of your computer"
},
"key": {
"$ref": "#/$defs/key"
},
"keyColor": {
"$ref": "#/$defs/keyColor"
},
"keyWidth": {
"$ref": "#/$defs/keyWidth"
},
"format": {
"$ref": "#/$defs/format"
}
},
"additionalProperties": false
},
{
"title": "Local IP",
"properties": {
+1 -4
View File
@@ -16,10 +16,7 @@
"separator",
"memory",
"swap",
{
"type": "disk",
"folders": "/"
},
"disk",
"battery",
{
"type": "colors",
@@ -93,11 +93,11 @@ static void detectWarpTerminal(FFTerminalFontResult* terminalFont)
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
{
if(ffStrbufIgnCaseCompS(&terminal->processName, "iterm.app") == 0 ||
if(ffStrbufIgnCaseEqualS(&terminal->processName, "iterm.app") ||
ffStrbufStartsWithIgnCaseS(&terminal->processName, "iTermServer-"))
detectIterm2(terminalFont);
else if(ffStrbufIgnCaseCompS(&terminal->processName, "Apple_Terminal") == 0)
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "Apple_Terminal"))
detectAppleTerminal(terminalFont);
else if(ffStrbufIgnCaseCompS(&terminal->processName, "WarpTerminal") == 0)
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "WarpTerminal"))
detectWarpTerminal(terminalFont);
}
@@ -87,9 +87,9 @@ static void detectConEmu(FFTerminalFontResult* terminalFont)
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
{
if(ffStrbufIgnCaseCompS(&terminal->processName, "mintty") == 0)
if(ffStrbufIgnCaseEqualS(&terminal->processName, "mintty"))
detectMintty(terminalFont);
else if(ffStrbufIgnCaseCompS(&terminal->processName, "conhost.exe") == 0)
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "conhost.exe"))
detectConhost(terminalFont);
else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "ConEmu"))
detectConEmu(terminalFont);
@@ -15,7 +15,6 @@ typedef struct FFShellResult
typedef struct FFTerminalResult
{
FFstrbuf processName;
FFstrbuf exe;
FFstrbuf prettyName;
+4 -4
View File
@@ -502,10 +502,10 @@ void ffLogoPrint(void)
//Terminal emulators that support kitty graphics protocol.
bool supportsKitty =
ffStrbufIgnCaseCompS(&terminal->processName, "kitty") == 0 ||
ffStrbufIgnCaseCompS(&terminal->processName, "konsole") == 0 ||
ffStrbufIgnCaseCompS(&terminal->processName, "wezterm") == 0 ||
ffStrbufIgnCaseCompS(&terminal->processName, "wayst") == 0;
ffStrbufIgnCaseEqualS(&terminal->processName, "kitty") ||
ffStrbufIgnCaseEqualS(&terminal->processName, "konsole") ||
ffStrbufIgnCaseEqualS(&terminal->processName, "wezterm") ||
ffStrbufIgnCaseEqualS(&terminal->processName, "wayst");
//Try to load the logo as an image. If it succeeds, print it and return.
if(logoPrintImageIfExists(supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false))
+1 -1
View File
@@ -226,7 +226,7 @@ void ffPrintBatteryHelpFormat(void)
"Battery temperature",
"Battery cycle count",
"Battery serial number",
"Battery manufactorDate",
"Battery manufactor date",
});
}