Skip to content

Commit

Permalink
Merge pull request #1056 from fastfetch-cli/dev
Browse files Browse the repository at this point in the history
Release: v2.17.1
  • Loading branch information
CarterLi authored Jun 29, 2024
2 parents 74616c7 + f97a9fd commit b001ea4
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 18 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 2.17.1

Hotfix for a regression that breaks Qt font detection

Bugfixes:
* Don't generate and install `libffwinrt.dll.a` on MinGW (Windows)
* Fix building on Windows when imagemagick support is enabled (Logo, Windows)
* Don't print GPU frequency with `--gpu-temp` for Nvidia cards (#1052, GPU)
* `--gpu-driver-specific` needs to be specified
* Print formatted size when `--gpu-format` is used (#1052, GPU)
* Ignore QVariant format; fix unreadable Qt font (#1053, Theme, Linux)
* Fix segfaults with `--show-errors` and an invalid module (#1055)

# 2.17.0

Changes:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url

project(fastfetch
VERSION 2.17.0
VERSION 2.17.1
LANGUAGES C
DESCRIPTION "Fast neofetch-like system information tool"
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
Expand Down Expand Up @@ -1156,7 +1156,7 @@ if(WIN32)
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("winrt/Windows.Foundation.h" HAVE_WINRT)
if(HAVE_WINRT)
add_library(ffwinrt SHARED src/detection/media/media_windows.dll.cpp)
add_library(ffwinrt MODULE src/detection/media/media_windows.dll.cpp)
target_link_libraries(ffwinrt PRIVATE "RuntimeObject")
target_compile_definitions(ffwinrt PRIVATE WIN32_LEAN_AND_MEAN=1 WINRT_LEAN_AND_MEAN=1)
target_link_options(ffwinrt
Expand Down
2 changes: 2 additions & 0 deletions src/common/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
#include <handleapi.h>
#include <io.h>
typedef HANDLE FFNativeFD;
#define FF_INVALID_FD INVALID_HANDLE_VALUE
#else
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>
typedef int FFNativeFD;
#define FF_INVALID_FD (-1)
// procfs's file can be changed between read calls such as /proc/meminfo and /proc/uptime.
// one safe way to read correct data is reading the whole file in a single read syscall
// 8192 comes from procps-ng: https://gitlab.com/procps-ng/procps/-/blob/master/library/meminfo.c?ref_type=heads#L39
Expand Down
2 changes: 1 addition & 1 deletion src/common/printing.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
if(!instance.config.display.pipe)
{
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
if (moduleArgs->outputColor.length)
if (moduleArgs && moduleArgs->outputColor.length)
ffPrintColor(&moduleArgs->outputColor);
else if (instance.config.display.colorOutput.length)
ffPrintColor(&instance.config.display.colorOutput);
Expand Down
2 changes: 1 addition & 1 deletion src/detection/gpu/gpu_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
.type = &gpu->type,
.frequency = &gpu->frequency,
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
}, "libnvidia-ml.so");
}

Expand Down
2 changes: 1 addition & 1 deletion src/detection/gpu/gpu_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist*
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
.type = &gpu->type,
.frequency = &gpu->frequency,
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
},
dllName
);
Expand Down
2 changes: 1 addition & 1 deletion src/detection/gpu/gpu_wsl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
.type = &gpu->type,
.frequency = &gpu->frequency,
.frequency = options->driverSpecific ? &gpu->frequency : NULL,
}, "/usr/lib/wsl/lib/libnvidia-ml.so");
}
}
Expand Down
11 changes: 8 additions & 3 deletions src/detection/gtk_qt/qt.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,16 @@ static void detectQtCt(char qver, FFQtResult* result)
ffParsePropFileConfigValues(file, 3, (FFpropquery[]) {
{"style=", &result->widgetStyle},
{"icon_theme=", &result->icons},
// FIXME: on older versions this was hex-encoded binary format
// (See QVariant notes on https://doc.qt.io/qt-5/qsettings.html)
// Thankfully, newer versions use the more common font encoding.
{"general=", &result->font}
});

if (ffStrbufStartsWithC(&result->font, '@'))
{
// See QVariant notes on https://doc.qt.io/qt-5/qsettings.html and
// https://github.com/fastfetch-cli/fastfetch/issues/1053#issuecomment-2197254769
// Thankfully, newer versions use the more common font encoding.
ffStrbufSetNS(&result->font, 5, file);
}
}

static void detectKvantum(FFQtResult* result)
Expand Down
15 changes: 10 additions & 5 deletions src/logo/image/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,20 @@ FFLogoImageResult ffLogoPrintImageImpl(FFLogoRequestData* requestData, const FFI
return printSuccessful ? FF_LOGO_IMAGE_RESULT_SUCCESS : FF_LOGO_IMAGE_RESULT_RUN_ERROR;
}

static int getCacheFD(FFLogoRequestData* requestData, const char* fileName)
static FFNativeFD getCacheFD(FFLogoRequestData* requestData, const char* fileName)
{
uint32_t cacheDirLength = requestData->cacheDir.length;
ffStrbufAppendS(&requestData->cacheDir, fileName);
#ifndef _WIN32
int fd = open(requestData->cacheDir.chars, O_RDONLY
#ifdef O_CLOEXEC
| O_CLOEXEC
#endif
);
#else
HANDLE fd = CreateFileA(requestData->cacheDir.chars, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
#endif
ffStrbufSubstrBefore(&requestData->cacheDir, cacheDirLength);
return fd;
}
Expand Down Expand Up @@ -740,17 +745,17 @@ static bool printCachedPixel(FFLogoRequestData* requestData)
return false;
}

FF_AUTO_CLOSE_FD int fd = -1;
FF_AUTO_CLOSE_FD FFNativeFD fd = FF_INVALID_FD;
if(requestData->type == FF_LOGO_TYPE_IMAGE_KITTY)
{
fd = getCacheFD(requestData, FF_CACHE_FILE_KITTY_COMPRESSED);
if(fd == -1)
if(fd == FF_INVALID_FD)
fd = getCacheFD(requestData, FF_CACHE_FILE_KITTY_UNCOMPRESSED);
}
else if(requestData->type == FF_LOGO_TYPE_IMAGE_SIXEL)
fd = getCacheFD(requestData, FF_CACHE_FILE_SIXEL);

if(fd == -1)
if(fd == FF_INVALID_FD)
return false;

ffPrintCharTimes('\n', options->paddingTop);
Expand Down Expand Up @@ -783,7 +788,7 @@ static bool printCachedPixel(FFLogoRequestData* requestData)
{
char buffer[32768];
ssize_t readBytes;
while((readBytes = ffReadFDData(FFUnixFD2NativeFD(fd), sizeof(buffer), buffer)) > 0)
while((readBytes = ffReadFDData(fd, sizeof(buffer), buffer)) > 0)
ffWriteFDData(FFUnixFD2NativeFD(STDOUT_FILENO), (size_t) readBytes, buffer);
}

Expand Down
17 changes: 13 additions & 4 deletions src/modules/gpu/gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,26 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu
{
FF_STRBUF_AUTO_DESTROY tempStr = ffStrbufCreate();
ffTempsAppendNum(gpu->temperature, &tempStr, options->tempConfig, &options->moduleArgs);
FF_STRBUF_AUTO_DESTROY dTotal = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY dUsed = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY sTotal = ffStrbufCreate();
FF_STRBUF_AUTO_DESTROY sUsed = ffStrbufCreate();
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->dedicated.total, &dTotal);
if (gpu->dedicated.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->dedicated.used, &dUsed);
if (gpu->shared.total != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.total, &sTotal);
if (gpu->shared.used != FF_GPU_VMEM_SIZE_UNSET) ffParseSize(gpu->shared.used, &sUsed);

FF_PRINT_FORMAT_CHECKED(FF_GPU_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_GPU_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor, "vendor"},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->driver, "driver"},
{FF_FORMAT_ARG_TYPE_STRBUF, &tempStr, "temperature"},
{FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount, "core-count"},
{FF_FORMAT_ARG_TYPE_STRING, type, "type"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.total, "dedicated-total"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->dedicated.used, "dedicated-used"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.total, "shared-total"},
{FF_FORMAT_ARG_TYPE_UINT64, &gpu->shared.used, "shared-used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dTotal, "dedicated-total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &dUsed, "dedicated-used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &sTotal, "shared-total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &sUsed, "shared-used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &gpu->platformApi, "platform-api"},
{FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->frequency, "frequency"},
}));
Expand Down

0 comments on commit b001ea4

Please sign in to comment.