diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a5e27f87c..1724c0e710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fc5d0e064..025e14acd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" @@ -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 diff --git a/src/common/io/io.h b/src/common/io/io.h index d188942ca6..305cb03e7c 100644 --- a/src/common/io/io.h +++ b/src/common/io/io.h @@ -8,11 +8,13 @@ #include #include typedef HANDLE FFNativeFD; + #define FF_INVALID_FD INVALID_HANDLE_VALUE #else #include #include #include 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 diff --git a/src/common/printing.c b/src/common/printing.c index a9888af3bd..a52f2c2799 100644 --- a/src/common/printing.c +++ b/src/common/printing.c @@ -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); diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index 28b33f38ce..3a4ecf3d65 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -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"); } diff --git a/src/detection/gpu/gpu_windows.c b/src/detection/gpu/gpu_windows.c index 261d0e82ad..34ecaa5379 100644 --- a/src/detection/gpu/gpu_windows.c +++ b/src/detection/gpu/gpu_windows.c @@ -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 ); diff --git a/src/detection/gpu/gpu_wsl.cpp b/src/detection/gpu/gpu_wsl.cpp index e4ef8e4fff..0b9c440d06 100644 --- a/src/detection/gpu/gpu_wsl.cpp +++ b/src/detection/gpu/gpu_wsl.cpp @@ -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"); } } diff --git a/src/detection/gtk_qt/qt.c b/src/detection/gtk_qt/qt.c index ed84657811..02c578a167 100644 --- a/src/detection/gtk_qt/qt.c +++ b/src/detection/gtk_qt/qt.c @@ -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) diff --git a/src/logo/image/image.c b/src/logo/image/image.c index bb337c3a35..d6f75c1926 100644 --- a/src/logo/image/image.c +++ b/src/logo/image/image.c @@ -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; } @@ -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); @@ -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); } diff --git a/src/modules/gpu/gpu.c b/src/modules/gpu/gpu.c index 002c3d7fb7..ddcfe7e06a 100644 --- a/src/modules/gpu/gpu.c +++ b/src/modules/gpu/gpu.c @@ -75,6 +75,15 @@ 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"}, @@ -82,10 +91,10 @@ static void printGPUResult(FFGPUOptions* options, uint8_t index, const FFGPUResu {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"}, }));