From 53c6a0ec9fc1781aa16bcd9ba4ec67f485ee0f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 12 Jan 2023 22:19:14 +0800 Subject: [PATCH 1/9] GPU: apply GPU type selection logic to Windows --- src/detection/gpu/gpu_windows.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detection/gpu/gpu_windows.cpp b/src/detection/gpu/gpu_windows.cpp index 41eab75cc..07b711205 100644 --- a/src/detection/gpu/gpu_windows.cpp +++ b/src/detection/gpu/gpu_windows.cpp @@ -26,8 +26,6 @@ static const char* detectWithDxgi(FFlist* gpus) FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus); - gpu->type = FF_GPU_TYPE_UNKNOWN; - if(wmemchr((const wchar_t[]) {0x1002, 0x1022}, (wchar_t)desc.VendorId, 2)) ffStrbufInitS(&gpu->vendor, FF_GPU_VENDOR_NAME_AMD); else if(wmemchr((const wchar_t[]) {0x03e7, 0x8086, 0x8087}, (wchar_t)desc.VendorId, 3)) @@ -42,6 +40,8 @@ static const char* detectWithDxgi(FFlist* gpus) ffStrbufInit(&gpu->driver); + gpu->type = desc.DedicatedVideoMemory >= 1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED; + adapter->Release(); gpu->temperature = FF_GPU_TEMP_UNSET; From 2b5511997cee9c9107d1c78ce09fd5fbd36777a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 12 Jan 2023 22:41:11 +0800 Subject: [PATCH 2/9] Global: support hiding other texts when printing percentage values --- CHANGELOG.md | 1 + src/common/bar.h | 1 + src/data/config_user.txt | 2 +- src/data/help.txt | 2 +- src/modules/battery.c | 3 ++- src/modules/disk.c | 15 ++++++++++----- src/modules/memory.c | 6 ++++-- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcbc706da..737092a23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Features: * Detect terminal version when available * Support `WezTerm` terminal font detection (requires [`wezterm` executable](https://wezfurlong.org/wezterm/cli/general.html) being available) * Add `--shell-version` and `--terminal-version` options to disable shell / terminal version detection +* Enhance `--percent-type` to allow hiding other texts (#387) Logos: * Raspbian (@IamNoRobot, #373) diff --git a/src/common/bar.h b/src/common/bar.h index a6c2be234..575adc01d 100644 --- a/src/common/bar.h +++ b/src/common/bar.h @@ -9,6 +9,7 @@ enum { FF_PERCENTAGE_TYPE_NUM_BIT = 1, FF_PERCENTAGE_TYPE_BAR_BIT = 2, + FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT = 4, }; void ffAppendPercentBar(FFinstance* instance, FFstrbuf* buffer, uint8_t percent, uint8_t green, uint8_t yellow, uint8_t red); diff --git a/src/data/config_user.txt b/src/data/config_user.txt index b68b845ca..435143dc4 100644 --- a/src/data/config_user.txt +++ b/src/data/config_user.txt @@ -259,7 +259,7 @@ # Percentage output type option # Applies to all modules that prints percentage values. Currently memory, swap, disk, battery and CPU usage are supported. # Only works with default format ( without --module-format option ). -# 0: prints none; 1: prints percent number only; 2: prints bar only; 3: prints both percent number and bar +# 0: prints none; 1: prints percent number only; 2: prints bar only; 3: prints both percent number and bar; 6: prints bar and hide other texts #--percent-type 1 # Key options: diff --git a/src/data/help.txt b/src/data/help.txt index c83dec794..81b52dd7f 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -125,7 +125,7 @@ Module specific options: --weather-output-format: The output weather format to be used. It must be URI encoded. --player-name: The name of the player to use --gl : Set the OpenGL context creation library to use. Must be auto, egl, glx or osmesa. Default is auto - --percent-type : Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both. Default is 1 + --percent-type : Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only. Default is 1 Parsing is not case sensitive. E.g. "--lib-PCI" is equal to "--Lib-Pci" If a value starts with a ?, it is optional. "true" will be used if not set. diff --git a/src/modules/battery.c b/src/modules/battery.c index 97c603d9a..79cdf4c79 100644 --- a/src/modules/battery.c +++ b/src/modules/battery.c @@ -13,6 +13,7 @@ static void printBattery(FFinstance* instance, BatteryResult* result, uint8_t in ffPrintLogoAndKey(instance, FF_BATTERY_MODULE_NAME, index, &instance->config.battery.key); bool showStatus = + !(instance->config.percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT) && result->status.length > 0 && ffStrbufIgnCaseCompS(&result->status, "Unknown") != 0; @@ -35,7 +36,7 @@ static void printBattery(FFinstance* instance, BatteryResult* result, uint8_t in { if(str.length > 0) ffStrbufAppendC(&str, ' '); - ffStrbufAppendF(&str, "%.0f%%", result->capacity); + ffStrbufAppendF(&str, str.length > 0 ? "(%u%%)" : "%u%%", (unsigned) result->capacity); } } diff --git a/src/modules/disk.c b/src/modules/disk.c index ba07fb823..df7614d5c 100644 --- a/src/modules/disk.c +++ b/src/modules/disk.c @@ -47,17 +47,22 @@ static void printDisk(FFinstance* instance, const FFDisk* disk) ffAppendPercentBar(instance, &str, bytesPercentage, 0, 5, 8); ffStrbufAppendC(&str, ' '); } - ffStrbufAppendF(&str, "%s / %s", usedPretty.chars, totalPretty.chars); + + if(!(instance->config.percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT)) + ffStrbufAppendF(&str, "%s / %s ", usedPretty.chars, totalPretty.chars); if(instance->config.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) - ffStrbufAppendF(&str, " (%u%%)", bytesPercentage); + { + ffStrbufAppendF(&str, str.length > 0 ? "(%u%%) " : "%u%% ", bytesPercentage); + } } else - ffStrbufAppendS(&str, "Unknown"); + ffStrbufAppendS(&str, "Unknown "); - if(disk->type == FF_DISK_TYPE_EXTERNAL) - ffStrbufAppendS(&str, " [Removable]"); + if(disk->type == FF_DISK_TYPE_EXTERNAL && !(instance->config.percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT)) + ffStrbufAppendS(&str, "[Removable]"); + ffStrbufTrimRight(&str, ' '); ffStrbufPutTo(&str, stdout); ffStrbufDestroy(&str); } diff --git a/src/modules/memory.c b/src/modules/memory.c index 149eef45b..fbb893f02 100644 --- a/src/modules/memory.c +++ b/src/modules/memory.c @@ -52,11 +52,13 @@ static void printMemory(FFinstance* instance, const char* name, const FFModuleAr ffStrbufAppendC(&str, ' '); } - ffStrbufAppendF(&str, "%s / %s", usedPretty.chars, totalPretty.chars); + if(!(instance->config.percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT)) + ffStrbufAppendF(&str, "%s / %s ", usedPretty.chars, totalPretty.chars); if(instance->config.percentType & FF_PERCENTAGE_TYPE_NUM_BIT) - ffStrbufAppendF(&str, " (%u%%)", percentage); + ffStrbufAppendF(&str, str.length > 0 ? "(%u%%)" : "%u%%", percentage); + ffStrbufTrimRight(&str, ' '); ffStrbufPutTo(&str, stdout); ffStrbufDestroy(&str); } From 67ab7c07796122a1cca07e50dd0c34d2bf9e3d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 13 Jan 2023 10:43:33 +0800 Subject: [PATCH 3/9] GPU: support vendor detection --- src/detection/gpu/gpu.h | 1 + src/detection/gpu/gpu_apple.c | 15 ++++++++++++++- src/util/apple/cf_helpers.c | 29 ++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/detection/gpu/gpu.h b/src/detection/gpu/gpu.h index e36e1d5ea..e14feb9d8 100644 --- a/src/detection/gpu/gpu.h +++ b/src/detection/gpu/gpu.h @@ -8,6 +8,7 @@ #define FF_GPU_TEMP_UNSET (0/0.0) #define FF_GPU_CORE_COUNT_UNSET -1 +#define FF_GPU_VENDOR_NAME_APPLE "Apple" #define FF_GPU_VENDOR_NAME_AMD "AMD" #define FF_GPU_VENDOR_NAME_INTEL "Intel" #define FF_GPU_VENDOR_NAME_NVIDIA "NVIDIA" diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index d8867207f..5d4d05eae 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -5,6 +5,7 @@ #include "util/apple/cf_helpers.h" #include +#include static double detectGpuTemp(const FFstrbuf* gpuName) { @@ -61,7 +62,19 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) gpu->type = FF_GPU_TYPE_UNKNOWN; - ffStrbufInitA(&gpu->vendor, 0); + ffStrbufInit(&gpu->vendor); + int vendorId; + if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId)) + { + if(vendorId == 0x106b) + ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_APPLE); + else if(wmemchr((const wchar_t[]) {0x1002, 0x1022}, (wchar_t)vendorId, 2)) + ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_AMD); + else if(wmemchr((const wchar_t[]) {0x03e7, 0x8086, 0x8087}, (wchar_t)vendorId, 3)) + ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_INTEL); + else if(wmemchr((const wchar_t[]) {0x0955, 0x10de, 0x12d2}, (wchar_t)vendorId, 3)) + ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_NVIDIA); + } ffStrbufInit(&gpu->driver); ffCfDictGetString(properties, CFSTR("CFBundleIdentifier"), &gpu->driver); diff --git a/src/util/apple/cf_helpers.c b/src/util/apple/cf_helpers.c index 65dcd7248..f5c37b7ad 100644 --- a/src/util/apple/cf_helpers.c +++ b/src/util/apple/cf_helpers.c @@ -44,7 +44,10 @@ const char* ffCfDictGetString(CFDictionaryRef dict, CFStringRef key, FFstrbuf* r const char* ffCfDictGetBool(CFDictionaryRef dict, CFStringRef key, bool* result) { CFBooleanRef cf = (CFBooleanRef)CFDictionaryGetValue(dict, key); - if(cf == NULL || CFGetTypeID(cf) != CFBooleanGetTypeID()) + if(cf == NULL) + return "CFDictionaryGetValue() failed"; + + if(CFGetTypeID(cf) != CFBooleanGetTypeID()) return "TypeID is not 'CFBoolean'"; *result = CFBooleanGetValue(cf); @@ -53,13 +56,25 @@ const char* ffCfDictGetBool(CFDictionaryRef dict, CFStringRef key, bool* result) const char* ffCfDictGetInt(CFDictionaryRef dict, CFStringRef key, int* result) { - CFNumberRef cf = (CFNumberRef)CFDictionaryGetValue(dict, key); - if (cf == NULL || CFGetTypeID(cf) != CFNumberGetTypeID()) - return "TypeID is not 'CFNumber'"; + CFTypeRef cf = (CFTypeRef)CFDictionaryGetValue(dict, key); + if(cf == NULL) + return "CFDictionaryGetValue() failed"; - if(!CFNumberGetValue(cf, kCFNumberSInt32Type, result)) - return "Number type is not SInt32"; - return NULL; + if(CFGetTypeID(cf) == CFNumberGetTypeID()) + { + if(!CFNumberGetValue((CFNumberRef)cf, kCFNumberSInt32Type, result)) + return "Number type is not SInt32"; + return NULL; + } + else if(CFGetTypeID(cf) == CFDataGetTypeID()) + { + if(CFDataGetLength((CFDataRef)cf) != sizeof(int)) + return "Data length is not sizeof(int)"; + CFDataGetBytes((CFDataRef)cf, CFRangeMake(0, sizeof(int)), (uint8_t*)result); + return NULL; + } + + return "TypeID is neither 'CFNumber' nor 'CFData'"; } const char* ffCfDictGetDict(CFDictionaryRef dict, CFStringRef key, CFDictionaryRef* result) From dcf04aa4fe0d113a344ca09301f66f3aa7745762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 13 Jan 2023 15:44:52 +0800 Subject: [PATCH 4/9] GPU: detect type based on vendor --- src/detection/gpu/gpu_apple.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/detection/gpu/gpu_apple.c b/src/detection/gpu/gpu_apple.c index 5d4d05eae..413e65746 100644 --- a/src/detection/gpu/gpu_apple.c +++ b/src/detection/gpu/gpu_apple.c @@ -67,13 +67,25 @@ const char* ffDetectGPUImpl(FFlist* gpus, const FFinstance* instance) if(!ffCfDictGetInt(properties, CFSTR("vendor-id"), &vendorId)) { if(vendorId == 0x106b) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_APPLE); + gpu->type = FF_GPU_TYPE_INTEGRATED; + } else if(wmemchr((const wchar_t[]) {0x1002, 0x1022}, (wchar_t)vendorId, 2)) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_AMD); + gpu->type = FF_GPU_TYPE_DISCRETE; // Apple never used AMD CPUs + } else if(wmemchr((const wchar_t[]) {0x03e7, 0x8086, 0x8087}, (wchar_t)vendorId, 3)) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_INTEL); + gpu->type = FF_GPU_TYPE_INTEGRATED; + } else if(wmemchr((const wchar_t[]) {0x0955, 0x10de, 0x12d2}, (wchar_t)vendorId, 3)) + { ffStrbufAppendS(&gpu->vendor, FF_GPU_VENDOR_NAME_NVIDIA); + gpu->type = FF_GPU_TYPE_DISCRETE; + } } ffStrbufInit(&gpu->driver); From 83ea189d81287dd0b60ef9e7e3ae8d39e3bcb022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 13 Jan 2023 15:46:29 +0800 Subject: [PATCH 5/9] GPU: simplify code --- src/modules/gpu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/modules/gpu.c b/src/modules/gpu.c index a2daad515..6c673df36 100644 --- a/src/modules/gpu.c +++ b/src/modules/gpu.c @@ -37,13 +37,13 @@ static void printGPUResult(FFinstance* instance, uint8_t index, const FFGPUResul } else { - FFstrbuf type; + const char* type; if(gpu->type == FF_GPU_TYPE_INTEGRATED) - ffStrbufInitS(&type, "Integrated"); + type = "Integrated"; else if(gpu->type == FF_GPU_TYPE_DISCRETE) - ffStrbufInitS(&type, "Discrete"); + type = "Discrete"; else - ffStrbufInitS(&type, "Unknown"); + type = "Unknown"; ffPrintFormat(instance, FF_GPU_MODULE_NAME, index, &instance->config.gpu, FF_GPU_NUM_FORMAT_ARGS, (FFformatarg[]){ {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->vendor}, @@ -51,10 +51,8 @@ static void printGPUResult(FFinstance* instance, uint8_t index, const FFGPUResul {FF_FORMAT_ARG_TYPE_STRBUF, &gpu->driver}, {FF_FORMAT_ARG_TYPE_DOUBLE, &gpu->temperature}, {FF_FORMAT_ARG_TYPE_INT, &gpu->coreCount}, - {FF_FORMAT_ARG_TYPE_STRBUF, &type}, + {FF_FORMAT_ARG_TYPE_STRING, type}, }); - - ffStrbufDestroy(&type); } } From 3cee8f5475d5708b52b5c8179259a14156ba7caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 13 Jan 2023 19:03:09 +0800 Subject: [PATCH 6/9] FFlist: add new functions to make it be able to work as a queue --- src/util/FFlist.c | 22 ++++++++++++++++++++++ src/util/FFlist.h | 5 +++++ tests/list.c | 26 +++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/util/FFlist.c b/src/util/FFlist.c index d01353ffb..40ed90816 100644 --- a/src/util/FFlist.c +++ b/src/util/FFlist.c @@ -1,6 +1,7 @@ #include "FFlist.h" #include +#include void ffListInitA(FFlist* list, uint32_t elementSize, uint32_t capacity) { @@ -34,6 +35,27 @@ uint32_t ffListFirstIndexComp(const FFlist* list, void* compElement, bool(*compF return list->length; } +bool ffListShift(FFlist* list, void* result) +{ + if(list->length == 0) + return false; + + memcpy(result, list->data, list->elementSize); + memmove(list->data, list->data + list->elementSize, list->elementSize * (list->length - 1)); + --list->length; + return true; +} + +bool ffListPop(FFlist* list, void* result) +{ + if(list->length == 0) + return false; + + memcpy(result, ffListGet(list, list->length - 1), list->elementSize); + --list->length; + return result; +} + void ffListDestroy(FFlist* list) { //Avoid free-after-use. These 3 assignments are cheap so don't remove them diff --git a/src/util/FFlist.h b/src/util/FFlist.h index e65180d3a..5b42add89 100644 --- a/src/util/FFlist.h +++ b/src/util/FFlist.h @@ -26,6 +26,11 @@ void* ffListAdd(FFlist* list); FF_C_NODISCARD uint32_t ffListFirstIndexComp(const FFlist* list, void* compElement, bool(*compFunc)(const void*, const void*)); +// Removes the first element, and copy its value to `*result` +bool ffListShift(FFlist* list, void* result); +// Removes the last element, and copy its value to `*result` +bool ffListPop(FFlist* list, void* result); + void ffListDestroy(FFlist* list); static inline void ffListInit(FFlist* list, uint32_t elementSize) diff --git a/tests/list.c b/tests/list.c index b42ef4b18..db4db544a 100644 --- a/tests/list.c +++ b/tests/list.c @@ -31,6 +31,7 @@ static bool numEqualsAdapter(const void* first, const void* second) int main(void) { FFlist list; + uint32_t n = 0; //initA @@ -44,6 +45,14 @@ int main(void) FF_LIST_FOR_EACH(uint32_t, item, list) VERIFY(false); + //shift + VERIFY(!ffListShift(&list, &n)); + VERIFY(list.length == 0); + + //pop + VERIFY(!ffListPop(&list, &n)); + VERIFY(list.length == 0); + //add for (uint32_t i = 1; i <= FF_LIST_DEFAULT_ALLOC + 1; ++i) { @@ -64,6 +73,7 @@ int main(void) VERIFY(*(uint32_t*)ffListGet(&list, 0) == 1); VERIFY(*(uint32_t*)ffListGet(&list, i - 1) == i); } + VERIFY(list.length == FF_LIST_DEFAULT_ALLOC + 1); uint32_t sum = 0; //forEach @@ -72,11 +82,25 @@ int main(void) VERIFY(sum == (1 + FF_LIST_DEFAULT_ALLOC + 1) * (FF_LIST_DEFAULT_ALLOC + 1) / 2); // ffListFirstIndexComp - uint32_t n = 10; + n = 10; VERIFY(ffListFirstIndexComp(&list, &n, numEqualsAdapter) == 9); n = 999; VERIFY(ffListFirstIndexComp(&list, &n, numEqualsAdapter) == list.length); + //shift + VERIFY(ffListShift(&list, &n)); + VERIFY(n == 1); + VERIFY(list.length == FF_LIST_DEFAULT_ALLOC); + VERIFY(*(uint32_t*) ffListGet(&list, 0) == 2); + VERIFY(*(uint32_t*) ffListGet(&list, list.length - 1) == FF_LIST_DEFAULT_ALLOC + 1); + + //pop + VERIFY(ffListPop(&list, &n)); + VERIFY(n == FF_LIST_DEFAULT_ALLOC + 1); + VERIFY(list.length == FF_LIST_DEFAULT_ALLOC - 1); + VERIFY(*(uint32_t*) ffListGet(&list, 0) == 2); + VERIFY(*(uint32_t*) ffListGet(&list, list.length - 1) == FF_LIST_DEFAULT_ALLOC); + //Destroy ffListDestroy(&list); From e076097a7c7cde11415fb3bbc3d292c11213bf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 14 Jan 2023 00:19:55 +0800 Subject: [PATCH 7/9] FFlist: fix compiler warnings --- src/util/FFlist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/FFlist.c b/src/util/FFlist.c index 40ed90816..d2151b803 100644 --- a/src/util/FFlist.c +++ b/src/util/FFlist.c @@ -1,7 +1,7 @@ #include "FFlist.h" #include -#include +#include void ffListInitA(FFlist* list, uint32_t elementSize, uint32_t capacity) { From cdff99339e108756e02bafd942c9e81ec8c6bba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 14 Jan 2023 17:31:04 +0800 Subject: [PATCH 8/9] Windows: fix the last issue that breaks Win10- --- src/common/init.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/init.c b/src/common/init.c index 97184f345..05827dd31 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -400,6 +400,10 @@ static void resetConsole() if(ffHideCursor) fputs("\033[?25h", stdout); + + #if defined(_WIN32) && defined(FF_ENABLE_BUFFER) + fflush(stdout); + #endif } #ifdef _WIN32 From 9c0fc63ee9a02d567457717cb80ee6220cb75109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 14 Jan 2023 17:46:11 +0800 Subject: [PATCH 9/9] Windows: with cdff99, the special build for Win7 is no longer needed. Drop it. --- .github/workflows/push.yml | 77 +------------------------------------- README.md | 5 +-- 2 files changed, 2 insertions(+), 80 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 006e26d22..05e721183 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -197,80 +197,6 @@ jobs: name: fastfetch-windows path: ./fastfetch-*-Windows.zip - win7: - name: Win7 - runs-on: windows-latest - permissions: - security-events: write - contents: read - defaults: - run: - shell: msys2 {0} - steps: - - name: checkout repository - uses: actions/checkout@v3 - - - name: setup-msys2 - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: git zip mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc mingw-w64-x86_64-cjson mingw-w64-x86_64-vulkan-loader mingw-w64-x86_64-opencl-icd - - - name: print msys version - run: uname -a - - # https://github.com/msys2/MINGW-packages/issues/13524#event-7555720785 - - name: create OpenCL.pc - run: | - cat > /mingw64/lib/pkgconfig/OpenCL.pc << EOF - prefix=/mingw64 - exec_prefix=${prefix} - libdir=${exec_prefix}/lib - includedir=${prefix}/include - - Name: OpenCL - Description: Open Computing Language generic Installable Client Driver Loader - Version: 2022.09.30-1 - Libs: -L${libdir} -lOpenCL.dll - Cflags: -I${includedir} - EOF - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: c, cpp - - - name: configure project - run: env PKG_CONFIG_PATH=/mingw64/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_BUFFER=Off . - - - name: build project - run: cmake --build . - - - name: perform CodeQL analysis - uses: github/codeql-action/analyze@v2 - - - name: copy necessary dlls - run: cp /mingw64/bin/{libcjson,libOpenCL,vulkan-1}.dll . - - - name: run fastfetch - run: time ./fastfetch --disable-linewrap false --hide-cursor false --show-errors true --load-config presets/all - - - name: run flashfetch - run: time ./flashfetch - - - name: run tests - run: ctest - - - name: create zip archive - run: zip fastfetch-$(./fastfetch --version-raw)-Win7.zip *.dll fastfetch.exe flashfetch.exe - - - name: upload artifacts - uses: actions/upload-artifact@v3 - with: - name: fastfetch-win7 - path: ./fastfetch-*-Win7.zip - release: if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'LinusDierheimer/fastfetch' name: Release @@ -280,7 +206,6 @@ jobs: - macos - freebsd - windows - - win7 permissions: contents: write steps: @@ -300,4 +225,4 @@ jobs: tag: ${{ needs.linux.outputs.ffversion }} commit: ${{ github.sha }} artifactErrorsFailBuild: true - artifacts: fastfetch-linux/*,fastfetch-macos/*,fastfetch-freebsd/*,fastfetch-windows/*,fastfetch-win7/* + artifacts: fastfetch-linux/*,fastfetch-macos/*,fastfetch-freebsd/*,fastfetch-windows/* diff --git a/README.md b/README.md index ed848668c..8c7ad6f70 100644 --- a/README.md +++ b/README.md @@ -70,10 +70,7 @@ For the image logo, iTerm with iterm image protocol should work. Apple Terminal * [`libvulkan`](https://www.vulkan.org/): Vulkan module. Usually has been provided by GPU drivers. [`vulkan-loader`](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-vulkan-loader) [`vulkan-headers`](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-vulkan-headers) * [`libOpenCL`](https://www.khronos.org/opencl/): OpenCL module. [`opencl-icd`](https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-opencl-icd) -Note: In Windows 7, 8 and 8.1, [ConEmu](https://conemu.github.io/en/AnsiEscapeCodes.html) is required to run fastfetch due to [the lack of ASCII escape code native support](https://en.wikipedia.org/wiki/ANSI_escape_code#DOS,_OS/2,_and_Windows). In addition, special build `fastfetch-win7` is provided to support these old systems, which - -1. Build with the ancient [MSVCRT](https://en.wikipedia.org/wiki/Microsoft_Windows_library_files#MSVCRT.DLL,_MSVCP*.DLL_and_CRTDLL.DLL) C runtime library, instead of the modern [UCRT](https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment) C runtime library -2. Disable stdout application buffer, which seems to problematic for ConEmu. +Note: In Windows 7, 8 and 8.1, [ConEmu](https://conemu.github.io/en/AnsiEscapeCodes.html) is required to run fastfetch due to [the lack of ASCII escape code native support](https://en.wikipedia.org/wiki/ANSI_escape_code#DOS,_OS/2,_and_Windows). In addition, as fastfetch for Windows targets [UCRT](https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment) C runtime library, [it must be installed manually](https://support.microsoft.com/en-us/topic/update-for-universal-c-runtime-in-windows-c0514201-7fe6-95a3-b0a5-287930f3560c) as UCRT is only pre-installed in Windows 10 and later. For the image logo, only chafa is supported due to [the design flaw of ConPTY](https://github.com/microsoft/terminal/issues/1173). In addition, chafa support is not built by default due to the massive dependencies of imagemagick. You must built it yourself.