Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
cc2286f
Windows: fix compiling with imagemagick enabled
CarterLi Apr 2, 2023
8006b0c
Gamepad (Windows): change the name of Pro Controller
CarterLi Apr 2, 2023
708b4a8
Logo: add SteamOS (#439)
CarterLi Apr 2, 2023
c0ca022
Doc: update changelog
CarterLi Apr 2, 2023
9509718
Gamepad: fix copy-and-paste errors
CarterLi Apr 4, 2023
d5b6c14
Doc: update changelog
CarterLi Apr 4, 2023
71614e0
Font: code refactor
CarterLi Apr 4, 2023
4a07485
Remove leftover comment
LinusDierheimer Mar 2, 2023
e40d4b9
Fix a new compile warning
LinusDierheimer Apr 5, 2023
bd8d784
Fix flatpak package count
LinusDierheimer Apr 6, 2023
94cf9a8
Update Windows 11 ASCII
KingKrouch Apr 10, 2023
c6859d7
Merge pull request #445 from KingKrouch/winlogo-patch
LinusDierheimer Apr 10, 2023
4ced4f9
Update builtin.c
tdtooke Apr 11, 2023
757d947
Update builtin.c
tdtooke Apr 11, 2023
7d0a1c8
Merge pull request #446 from tdtooke/dev
LinusDierheimer Apr 12, 2023
3c0b2fc
Merge pull request #448 from LinusDierheimer/master
LinusDierheimer Apr 13, 2023
8f2b3c6
Processes: code refactor
CarterLi Apr 15, 2023
e690d73
CpuUsage: code refactor
CarterLi Apr 15, 2023
0e9d48f
FFstrbuf: remove FF_STRBUF_CREATE macro
CarterLi Apr 4, 2023
d570e59
--pipe: don't print white color blocks
LinusDierheimer Apr 17, 2023
94e6f40
Network (macOS): init
CarterLi Apr 18, 2023
94e1ed1
Network (Windows): add support
CarterLi Apr 18, 2023
7e072c3
Network (Linux): add support
CarterLi Apr 18, 2023
24a3783
Network: code refactor & bug fixes
CarterLi Apr 18, 2023
9a1bc66
Network (FreeBSD): add dirty support
CarterLi Apr 18, 2023
26feccc
LocalIP: simplify loop interface detection
CarterLi Apr 18, 2023
4fd82b1
Doc: document Network module
CarterLi Apr 18, 2023
60cf3ec
OpenCL: split detection code
CarterLi Apr 25, 2023
4d7cb25
DisplayServer (Windows): code simplification
CarterLi Apr 25, 2023
8cf0330
Fix EndeavourOS logo again
Edsploration Apr 27, 2023
dc2a349
Network: drop module
CarterLi May 3, 2023
aea0986
CMake(Windows): remove USE_WIN_NTAPI option
CarterLi May 11, 2023
e837e1e
Swap: split module code from `memory.c`
CarterLi May 11, 2023
424ca92
Vulkan: try fixing #456
CarterLi May 16, 2023
b89ace7
Swap (Windows): fix compiler warnings
CarterLi May 16, 2023
e45c4b4
TerminalShell: support xonsh
CarterLi May 24, 2023
0a979dd
TerminalShell: fix iTerm being detected as iTermServer-* sometimes
CarterLi May 24, 2023
60c1a55
Logo: add macOS small version
CarterLi May 25, 2023
bb4bf63
Sound (macOS): detecting volume more aggressively
CarterLi May 26, 2023
f4ce5c4
TerminalShell: support Tabby terminal version detection
CarterLi May 26, 2023
b99b3ad
TerminalFont: support Tabby
CarterLi May 26, 2023
c9e3c34
Settings (Linux): fix memleaks reported by LeakSanitizer
CarterLi May 27, 2023
15a43a6
TerminalShel (Windows): detect Tabby version with exe file version
CarterLi May 27, 2023
bfec8b5
TerminalShell: code refactoring
CarterLi May 27, 2023
77f7c81
TerminalShell (Windows): print clink version
CarterLi May 27, 2023
1ae0a83
Windows: fix potential memory curruption bug in unicode.c
CarterLi May 27, 2023
c379c65
Disk (Windows): improve performance
CarterLi May 27, 2023
4f19bf9
Windows: use ffStrbufInitWS
CarterLi May 27, 2023
a7896c3
DisplayServer (Apple): use FF_AUTO_FREE
CarterLi May 27, 2023
5b65e18
Release: 1.11.1
CarterLi May 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# 1.11.1

Features:
* Support xonsh detection (TerminalShell)
* Support Tabby version / terminal font detection (TerminalFont)

Bugfixes:
* Fix name of Pro Controller (Gamepad, Windows)
* Fix compile error with imagemagick enabled (Windows)
* Fix copy-and-paste errors (Gamepad)
* Flatpak: Fix user package count
* Flatpak: Count runtime packages too (#441)
* Fix flatpak package count (#441)
* Don't print white color blocks with `--pipe` (#450)
* Fix iTerm being detected as iTermServer-* sometimes
* Fix sound device volume being incorrectly detected as muted sometimes (Sound)
* Fix memleaks reported by LeakSanitizer (Linux)
* Fix potential memory curruption bug in unicode.c (Windows)

Logo:
* Update Windows 11 ASCII logo to look more visually consistent (#445)
* Add another font color index to arch icon (#446)
* Add SteamOS
* Add macOS small / small2

# 1.11.0

Features:
Expand Down
15 changes: 7 additions & 8 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 1.11.0
VERSION 1.11.1
LANGUAGES C
DESCRIPTION "Fast system information tool"
HOMEPAGE_URL "https://github.com/LinusDierheimer/fastfetch"
Expand Down Expand Up @@ -73,7 +73,6 @@ cmake_dependent_option(ENABLE_PULSE "Enable pulse" ON "LINUX OR BSD" OFF)
cmake_dependent_option(ENABLE_LIBCJSON "Enable libcjson" ON "LINUX OR WIN32" OFF)
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
cmake_dependent_option(ENABLE_BUFFER "Enable stdout buffer" ON "LINUX OR APPLE OR BSD OR WIN32 OR ANDROID" OFF)
cmake_dependent_option(USE_WIN_NTAPI "Allow using internal NTAPI" ON "WIN32" OFF)

option(BUILD_TESTS "Build tests" OFF) # Also create test executables
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
Expand Down Expand Up @@ -248,6 +247,7 @@ set(LIBFASTFETCH_SRC
src/detection/host/host.c
src/detection/locale/locale.c
src/detection/media/media.c
src/detection/opencl/opencl.c
src/detection/os/os.c
src/detection/packages/packages.c
src/detection/terminalfont/terminalfont.c
Expand Down Expand Up @@ -296,6 +296,7 @@ set(LIBFASTFETCH_SRC
src/modules/separator.c
src/modules/shell.c
src/modules/sound.c
src/modules/swap.c
src/modules/media.c
src/modules/terminal.c
src/modules/terminalfont.c
Expand Down Expand Up @@ -518,11 +519,11 @@ elseif(WIN32)
src/detection/os/os_windows.cpp
src/detection/packages/packages_windows.c
src/detection/poweradapter/poweradapter_nosupport.c
src/detection/processes/processes_windows.cpp
src/detection/processes/processes_windows.c
src/detection/sound/sound_windows.cpp
src/detection/swap/swap_windows.cpp
src/detection/swap/swap_windows.c
src/detection/terminalfont/terminalfont_windows.c
src/detection/terminalshell/terminalshell_windows.cpp
src/detection/terminalshell/terminalshell_windows.c
src/detection/temps/temps_windows.cpp
src/detection/uptime/uptime_windows.c
src/detection/users/users_windows.c
Expand Down Expand Up @@ -710,6 +711,7 @@ if(APPLE)
PRIVATE "-framework IOKit"
PRIVATE "-framework OpenGL"
PRIVATE "-framework OpenCL"
PRIVATE "-framework SystemConfiguration"
PRIVATE "-weak_framework CoreDisplay"
PRIVATE "-weak_framework DisplayServices -F /System/Library/PrivateFrameworks"
PRIVATE "-weak_framework MediaRemote -F /System/Library/PrivateFrameworks"
Expand All @@ -732,9 +734,6 @@ elseif(WIN32)
PRIVATE "wtsapi32"
PRIVATE "powrprof"
)
if(USE_WIN_NTAPI)
target_compile_definitions(libfastfetch PRIVATE FF_USE_WIN_NTAPI)
endif()
endif()

target_include_directories(libfastfetch
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Battery, Bios, Bluetooth, Board, Break, Brightness, Colors, Command, CPU, CPUUsa

##### Builtin logos
```
AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, Crystal, Debian, Deepin, Devuan, Endeavour, Enso, Fedora, FreeBSD, Garuda, Gentoo, KDE Neon, KISS, Kubuntu, LangitKetujuh, Linux, MacOS, Manjaro, Mint, MSYS2, NixOS, Nobara, OpenSUSE, OpenSUSE LEAP, OpenSUSE Tumbleweed, Parabola, Pop!_OS, Raspbian, RebornOS, RedstarOS, Rocky, Rosa, Slackware, Solus, Ubuntu, Vanilla, Void, Windows, Windows 11, Windows 8, Zorin
AlmaLinux, Alpine, Android, Arch, Arco, Artix, Bedrock, CachyOS, CentOS, CRUX, Crystal, Debian, Deepin, Devuan, Endeavour, Enso, Fedora, FreeBSD, Garuda, Gentoo, KDE Neon, KISS, Kubuntu, LangitKetujuh, Linux, MacOS, Manjaro, Mint, MSYS2, NixOS, Nobara, OpenSUSE, OpenSUSE LEAP, OpenSUSE Tumbleweed, Parabola, Pop!_OS, Raspbian, RebornOS, RedstarOS, Rocky, Rosa, Slackware, Solus, SteamOS, Ubuntu, Vanilla, Void, Windows, Windows 11, Windows 8, Zorin
```

##### Package managers
Expand All @@ -114,7 +114,7 @@ Budgie, Cinnamon, Gnome, KDE Plasma, LXQt, Mate, XFCE4

##### Terminal fonts
```
Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, mintty, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal
Alacritty, Apple Terminal, ConEmu, Deepin Terminal, foot, Gnome Terminal, iTerm2, Kitty, Konsole, LXTerminal, mintty, Tabby, Terminator, Termux, Tilix, TTY, Warp, WezTerm, Windows Terminal, XFCE4 Terminal
```

## Building
Expand Down
2 changes: 2 additions & 0 deletions src/common/parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#ifndef FF_INCLUDED_parsing_h
#define FF_INCLUDED_parsing_h

#include "fastfetch.h"

#include <stdint.h>

typedef struct FFVersion
Expand Down
4 changes: 2 additions & 2 deletions src/common/properties.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uin
FFstrbuf baseDir;
ffStrbufInitA(&baseDir, 64);

for(uint32_t i = 0; i < list->length; i++)
FF_LIST_FOR_EACH(FFstrbuf, dirPrefix, *list)
{
//We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
ffStrbufSet(&baseDir, ffListGet(list, i));
ffStrbufSet(&baseDir, dirPrefix);
ffStrbufAppendS(&baseDir, relativeFile);

if(ffParsePropFileValues(baseDir.chars, numQueries, queries))
Expand Down
25 changes: 17 additions & 8 deletions src/common/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,31 @@ typedef enum FFInitState

typedef struct GVariantGetters
{
FF_LIBRARY_SYMBOL(g_variant_get_string)
FF_LIBRARY_SYMBOL(g_variant_dup_string)
FF_LIBRARY_SYMBOL(g_variant_get_boolean)
FF_LIBRARY_SYMBOL(g_variant_get_int32)
FF_LIBRARY_SYMBOL(g_variant_unref)
} GVariantGetters;

static FFvariant getGVariantValue(GVariant* variant, FFvarianttype type, const GVariantGetters* variantGetters)
{
FFvariant result;

if(variant == NULL)
return FF_VARIANT_NULL;
result = FF_VARIANT_NULL;
else if(type == FF_VARIANT_TYPE_STRING)
return (FFvariant) {.strValue = variantGetters->ffg_variant_get_string(variant, NULL)};
result = (FFvariant) {.strValue = variantGetters->ffg_variant_dup_string(variant, NULL)}; // Dup string, so that variant itself can be freed
else if(type == FF_VARIANT_TYPE_BOOL)
return (FFvariant) {.boolValue = (bool) variantGetters->ffg_variant_get_boolean(variant), .boolValueSet = true};
result = (FFvariant) {.boolValue = (bool) variantGetters->ffg_variant_get_boolean(variant), .boolValueSet = true};
else if(type == FF_VARIANT_TYPE_INT)
return (FFvariant) {.intValue = variantGetters->ffg_variant_get_int32(variant)};
result = (FFvariant) {.intValue = variantGetters->ffg_variant_get_int32(variant)};
else
return FF_VARIANT_NULL;
result = FF_VARIANT_NULL;

if(variant)
variantGetters->ffg_variant_unref(variant);

return result;
}

typedef struct GSettingsData
Expand Down Expand Up @@ -102,9 +110,10 @@ static const GSettingsData* getGSettingsData(const FFinstance* instance)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_settings_schema_source_get_default)

#define data data.variantGetters
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_string)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_dup_string)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_boolean)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_int32)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_unref);
#undef data

data.schemaSource = data.ffg_settings_schema_source_get_default();
Expand Down Expand Up @@ -169,7 +178,7 @@ static const DConfData* getDConfData(const FFinstance* instance)
FF_LIBRARY_DATA_LOAD_SYMBOL(dconf_client_new)

#define data data.variantGetters
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_string)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_dup_string)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_boolean)
FF_LIBRARY_DATA_LOAD_SYMBOL(g_variant_get_int32)
#undef data
Expand Down
23 changes: 10 additions & 13 deletions src/detection/battery/battery_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@
#include <devguid.h>
#include <winternl.h>

#ifdef FF_USE_WIN_NTAPI
NTSYSCALLAPI
NTSTATUS
NTAPI
NtPowerInformation(
IN POWER_INFORMATION_LEVEL InformationLevel,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL,
IN ULONG OutputBufferLength);
#define CallNtPowerInformation NtPowerInformation
#endif
NTSYSCALLAPI
NTSTATUS
NTAPI
NtPowerInformation(
IN POWER_INFORMATION_LEVEL InformationLevel,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL,
IN ULONG OutputBufferLength);

static inline void wrapCloseHandle(HANDLE* handle)
{
Expand Down Expand Up @@ -147,7 +144,7 @@ const char* ffDetectBatteryImpl(FFinstance* instance, FFlist* results)
else
{
SYSTEM_BATTERY_STATE info;
if (NT_SUCCESS(CallNtPowerInformation(SystemBatteryState, NULL, 0, &info, sizeof(info))) && info.BatteryPresent)
if (NT_SUCCESS(NtPowerInformation(SystemBatteryState, NULL, 0, &info, sizeof(info))) && info.BatteryPresent)
{
BatteryResult* battery = (BatteryResult*)ffListAdd(results);
ffStrbufInit(&battery->modelName);
Expand Down
25 changes: 0 additions & 25 deletions src/detection/cpuUsage/cpuUsage_windows.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "fastfetch.h"
#include "cpuUsage.h"

#ifdef FF_USE_WIN_NTAPI

#include "util/mallocHelper.h"

#include <ntstatus.h>
Expand Down Expand Up @@ -37,26 +35,3 @@ const char* ffGetCpuUsageInfo(uint64_t* inUseAll, uint64_t* totalAll)

return NULL;
}

#else

#include <processthreadsapi.h>

static inline uint64_t fileTimeToUint64(const FILETIME* ft) {
return (((uint64_t)ft->dwHighDateTime) << 32) | ((uint64_t)ft->dwLowDateTime);
}

const char* ffGetCpuUsageInfo(uint64_t* inUseAll, uint64_t* totalAll)
{
FILETIME idleTime, kernelTime, userTime;
if(!GetSystemTimes(&idleTime, &kernelTime, &userTime))
return "GetSystemTimes() failed";

// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getsystemtimes
// `kernelTime` also includes the amount of time the system has been idle.
*totalAll = fileTimeToUint64(&userTime) + fileTimeToUint64(&kernelTime);
*inUseAll = *totalAll - fileTimeToUint64(&idleTime);
return NULL;
}

#endif
3 changes: 0 additions & 3 deletions src/detection/disk/disk_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ static bool isPhysicalDevice(FFstrbuf* device)
if(!S_ISBLK(deviceStat.st_mode))
return false;

//Ignore all devices that are not physical devices


//DrvFs is a filesystem plugin to WSL that was designed to support interop between WSL and the Windows filesystem.
if(ffStrbufEqualS(device, "drvfs"))
return true;
Expand Down
47 changes: 24 additions & 23 deletions src/detection/disk/disk_windows.c
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
#include "disk.h"
#include "util/windows/unicode.h"

#include <windows.h>
#include <assert.h>

void ffDetectDisksImpl(FFDiskResult* disks)
{
uint32_t length = GetLogicalDriveStringsA(0, NULL);
if(length == 0)
{
ffStrbufAppendS(&disks->error, "GetLogicalDriveStringsA failed");
return;
}

char* buf = malloc(length + 1);
GetLogicalDriveStringsA(length, buf);
wchar_t buf[MAX_PATH + 1];
uint32_t length = GetLogicalDriveStringsW(sizeof(buf) / sizeof(*buf), buf);
assert(length < sizeof(buf) / sizeof(*buf));

for(uint32_t i = 0; i < length; i++)
{
const char* mountpoint = buf + i;
const wchar_t* mountpoint = buf + i;

UINT driveType = GetDriveTypeA(mountpoint);
UINT driveType = GetDriveTypeW(mountpoint);
if(driveType == DRIVE_NO_ROOT_DIR)
{
i += (uint32_t)strlen(mountpoint);
i += (uint32_t)wcslen(mountpoint);
continue;
}

FFDisk* disk = ffListAdd(&disks->disks);
ffStrbufInitS(&disk->mountpoint, mountpoint);
ffStrbufInitWS(&disk->mountpoint, mountpoint);

uint64_t bytesFree;
if(!GetDiskFreeSpaceExA(mountpoint, NULL, (PULARGE_INTEGER)&disk->bytesTotal, (PULARGE_INTEGER)&bytesFree))
if(!GetDiskFreeSpaceExW(mountpoint, NULL, (PULARGE_INTEGER)&disk->bytesTotal, (PULARGE_INTEGER)&bytesFree))
{
disk->bytesTotal = 0;
bytesFree = 0;
Expand All @@ -43,27 +39,32 @@ void ffDetectDisksImpl(FFDiskResult* disks)
else
disk->type = FF_DISK_TYPE_HIDDEN;

ffStrbufInitA(&disk->filesystem, MAX_PATH + 1);
ffStrbufInitA(&disk->name, MAX_PATH + 1);
ffStrbufInit(&disk->filesystem);
ffStrbufInit(&disk->name);
wchar_t diskName[MAX_PATH + 1], diskFileSystem[MAX_PATH + 1];

//https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getvolumeinformationa#remarks
UINT errorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
GetVolumeInformationA(mountpoint,
disk->name.chars, disk->name.allocated, //Volume name

BOOL result = GetVolumeInformationW(mountpoint,
diskName, sizeof(diskName) / sizeof(*diskName), //Volume name
NULL, //Serial number
NULL, //Max component length
NULL, //File system flags
disk->filesystem.chars, disk->filesystem.allocated
diskFileSystem, sizeof(diskFileSystem) / sizeof(*diskFileSystem)
);
SetErrorMode(errorMode);
ffStrbufRecalculateLength(&disk->name);
ffStrbufRecalculateLength(&disk->filesystem);

if(result)
{
ffStrbufSetWS(&disk->filesystem, diskFileSystem);
ffStrbufSetWS(&disk->name, diskName);
}

//TODO: implement
disk->filesUsed = 0;
disk->filesTotal = 0;

i += disk->mountpoint.length;
}

free(buf);
}
5 changes: 2 additions & 3 deletions src/detection/displayserver/displayserver_apple.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "displayserver.h"
#include "common/sysctl.h"
#include "util/apple/cf_helpers.h"
#include "util/mallocHelper.h"

#include <stdlib.h>
#include <ctype.h>
Expand Down Expand Up @@ -73,7 +74,7 @@ static void detectWMPlugin(FFstrbuf* name)
u_int requestLength = sizeof(request) / sizeof(*request);

size_t length = 0;
struct kinfo_proc* processes = ffSysctlGetData(request, requestLength, &length);
FF_AUTO_FREE struct kinfo_proc* processes = ffSysctlGetData(request, requestLength, &length);
if(processes == NULL)
return;

Expand All @@ -94,8 +95,6 @@ static void detectWMPlugin(FFstrbuf* name)
name->chars[0] = (char) toupper(name->chars[0]);
break;
}

free(processes);
}

void ffConnectDisplayServerImpl(FFDisplayServerResult* ds, const FFinstance* instance)
Expand Down
Loading